我是Android編程和Google App Engine的新手。我跟着下面的文件來運行,其登記我的設備的示例應用程序:https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae註冊終端服務器失敗(App Engine已連接Android項目)
當我運行的應用程序(在設備上),我看到以下內容:
1)與谷歌雲端通訊註冊。 ..SUCCEEDED!
2)註冊端點服務器失敗!
無法將您的設備註冊到您的雲端點服務器。無論你的雲終端服務器沒有部署到App Engine,或者需要在CloudEndpointUtils.java
設置LOCAL_ANDROID_RUN爲「true」改爲針對本地實例上運行您的設置我還檢查logcat的,看看下面的例外:
六月1日至14日:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):在嘗試與服務器進行註冊時接收到的異常 六月1日至14日:05:40.268:E/com.googlecloudproject .GCMIntentService(1831):java.net.SocketTimeoutException:20000ms後無法連接到/10.0.2.2(端口8888) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):位於libcore。 io.IoB ridge.connectErrno(IoBridge.java:159) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at libcore.io.IoBridge.connect(IoBridge.java:112) 01-14 06/05:40.268:E/com.googlecloudproject.GCMIntentService(1831):在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService 1831):at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at java.net.Socket.connect(Socket。 java:872) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpConnection。(HttpConnection.java:76) 01-14 06:05:40.268 :E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpConnection。(HttpConnection.java:50) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpConnection $ Address.connect(HttpConnection.java:340) 01-14 06:05:40.268: E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):在libcore.net.http.HttpEngine.openSocketConnection(HttpEngine。 java:316) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpEngine.connect(HttpEngine.java:311) 01-14 06:05: 40.268:E/com.googlecloudproject.GCMIntentService(1831):在libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java :290) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240) 01-14 06:05:40.268 :E/com.googlecloudproject.GCMIntentService(1831):at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):在libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at com.google.api.client.http.javanet .NetHttpRequest.execute(NetHttpRequest.java:77) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):在com.google.api.client.http.HttpRequest.execute(HttpRequest。java:964) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410) 01 -14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) 01-14 06:05: 40.268:E/com.googlecloudproject.GCMIntentService(1831):com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) 01-14 06:05:40.268:E/com。 googlecloudproject.GCMIntentService(1831):at com.googlecloudproject.GCMIntentService.onRegistered(GCMIntentService.java:163) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):com.google.android。 gcm.GCM BaseIntentService.handleRegistration(GCMBaseIntentService.java:251) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:153) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at android.app.IntentService $ ServiceHandler.handleMessage(IntentService.java:65) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at android.os.Handler.dispatchMessage(Handler.java:99) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at android.os。 Looper.loop(Looper.java:158) 01-14 06:05:40.268:E/com.googlecloudproject.GCMIntentService(1831):at android.os.HandlerThread.run(HandlerThread.java:61)
任何人都可以提出什麼時候發生此異常以及爲什麼我的設備無法註冊雲端點?
您是針對部署的App Engine項目還是在本地服務器上進行測試?如果您的項目已部署,請將'LOCAL_ANDROID_RUN = true'行更改爲'LOCAL_ANDROID_RUN = false'。 – Floris
我在本地測試,所以我有我的LOCAL_ANDROID_RUN設置爲真 – Divya
我相信你正在測試手機,而不是使用模擬器。使用模擬器;你會跳過很多障礙。對於初學者來說,模擬器使用的地址(10.0.2.2) - 你的設備不會識別它 – kakoma