2013-06-02 78 views
0

我試圖用Google app Engine,GCM和Android構建一個非常簡單的應用程序。我使用Eclipse插件創建了一個簡單的Google AppEngine後端項目,以便與Android客戶端集成。當我嘗試運行應用程序時,我得到這個異常,我無法前進。我已經上網了,但我沒有得到太多的幫助。其次本教程中,AppEngine + GCM

DeviceInfo deviceInfo = new DeviceInfo(); 
    endpoint.insertDeviceInfo(
     deviceInfo 
      .setDeviceRegistrationID(registration) 
      .setTimestamp(System.currentTimeMillis()) 
      .setDeviceInformation(
       URLEncoder 
        .encode(android.os.Build.MANUFACTURER 
         + " " 
         + android.os.Build.PRODUCT, 
         "UTF-8"))).execute(); 
    } 

https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae

任何想法或幫助是極大的讚賞...

06-01 16:58:14.545: D/GCMBaseIntentService(6251): handleRegistration: registrationId = APA91bGUjtR-6HtiYBLQ0d4xwNxLeBOpuaTfjJhbLmsH5DUX7whMZ9W8GnHRDycp-AhWc67xGAAlcGQEQdMCNTLCj4N0b5zDIBfWa-e1okPaccwQ-ZMheyriA1_gkfs6XjIM_gO68181yToP7qGDgvXrJiVGPpBadHOd_X0Z9qFJEtYan4kaFls, error = null, unregistered = null 
06-01 16:58:14.545: D/GCMRegistrar(6251): resetting backoff for com.google.android.gcm.demo.app 
06-01 16:58:14.545: V/GCMRegistrar(6251): Saving regId on app version 1 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): Exception received when attempting to register with server at https://gcmdemoramesh.appspot.com/_ah/api/ 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): Not Found 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:111) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:38) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:314) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1060) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:412) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:345) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:463) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.android.gcm.demo.app.GCMIntentService.onRegistered(GCMIntentService.java:167) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.android.gcm.GCMBaseIntentService.handleRegistration(GCMBaseIntentService.java:251) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:153) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at android.os.Handler.dispatchMessage(Handler.java:99) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at android.os.Looper.loop(Looper.java:137) 
06-01 16:58:16.757: E/com.google.android.gcm.demo.app.GCMIntentService(6251): at android.os.HandlerThread.run(HandlerThread.java:60) 
06-01 16:58:16.837: V/GCMBaseIntentService(6251): Releasing wakelock 
06-01 16:58:52.202: D/GestureDetector(6251): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 6 mFalseSizeCnt:0 
06-01 16:58:52.322: E/ViewRootImpl(6251): sendUserActionEvent() mView == null 
06-01 16:59:04.204: E/MoreInfoHPW_ViewGroup(6835): Parent view is not a TextView 
06-01 16:59:04.234: D/dalvikvm(6835): GC_FOR_ALLOC freed 56K, 6% free 17219K/18220K, paused 17ms, total 17ms 
06-01 16:59:04.244: I/dalvikvm-heap(6835): Grow heap (frag case) to 19.985MB for 2359312-byte allocation 
06-01 16:59:04.254: D/dalvikvm(6835): GC_FOR_ALLOC freed 3K, 5% free 19519K/20528K, paused 16ms, total 16ms 
06-01 16:59:04.294: D/dalvikvm(6835): GC_CONCURRENT freed 50K, 6% free 19536K/20568K, paused 4ms+6ms, total 31ms 
06-01 16:59:04.294: V/GCMRegistrar(6835): Is registered on server: false 
06-01 16:59:04.294: I/GCMDemo(6835): registering device (regId = APA91bGUjtR-6HtiYBLQ0d4xwNxLeBOpuaTfjJhbLmsH5DUX7whMZ9W8GnHRDycp-AhWc67xGAAlcGQEQdMCNTLCj4N0b5zDIBfWa-e1okPaccwQ-ZMheyriA1_gkfs6XjIM_gO68181yToP7qGDgvXrJiVGPpBadHOd_X0Z9qFJEtYan4kaFls) 
06-01 16:59:04.294: D/GCMDemo(6835): Attempt #1 to register 
06-01 16:59:04.304: V/GCMDemo(6835): Posting 'regId=APA91bGUjtR-6HtiYBLQ0d4xwNxLeBOpuaTfjJhbLmsH5DUX7whMZ9W8GnHRDycp-AhWc67xGAAlcGQEQdMCNTLCj4N0b5zDIBfWa-e1okPaccwQ-ZMheyriA1_gkfs6XjIM_gO68181yToP7qGDgvXrJiVGPpBadHOd_X0Z9qFJEtYan4kaFls' to http://gcmdemoramesh.appspot.com//register 
06-01 16:59:04.344: D/libEGL(6835): loaded /system/lib/egl/libEGL_adreno200.so 
06-01 16:59:04.344: D/libEGL(6835): loaded /system/lib/egl/libGLESv1_CM_adreno200.so 
06-01 16:59:04.344: D/libEGL(6835): loaded /system/lib/egl/libGLESv2_adreno200.so 
06-01 16:59:04.344: I/Adreno200-EGL(6835): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: (CL3544079) 
06-01 16:59:04.344: I/Adreno200-EGL(6835): Build Date: 03/28/13 Thu 
06-01 16:59:04.344: I/Adreno200-EGL(6835): Local Branch: adreno_20130328 
06-01 16:59:04.344: I/Adreno200-EGL(6835): Remote Branch: 
06-01 16:59:04.344: I/Adreno200-EGL(6835): Local Patches: 
06-01 16:59:04.344: I/Adreno200-EGL(6835): Reconstruct Branch: 
06-01 16:59:04.394: D/OpenGLRenderer(6835): Enabling debug mode 0 
06-01 16:59:06.236: E/GCMDemo(6835): Failed to register on attempt 1 
06-01 16:59:06.236: E/GCMDemo(6835): java.io.IOException: Post failed with error code 404 
06-01 16:59:06.236: E/GCMDemo(6835): at com.google.android.gcm.demo.app.ServerUtilities.post(ServerUtilities.java:169) 
06-01 16:59:06.236: E/GCMDemo(6835): at com.google.android.gcm.demo.app.ServerUtilities.register(ServerUtilities.java:66) 
06-01 16:59:06.236: E/GCMDemo(6835): at com.google.android.gcm.demo.app.DemoActivity$2.doInBackground(DemoActivity.java:79) 
06-01 16:59:06.236: E/GCMDemo(6835): at com.google.android.gcm.demo.app.DemoActivity$2.doInBackground(DemoActivity.java:1) 
06-01 16:59:06.236: E/GCMDemo(6835): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
06-01 16:59:06.236: E/GCMDemo(6835): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
06-01 16:59:06.236: E/GCMDemo(6835): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
06-01 16:59:06.236: E/GCMDemo(6835): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
06-01 16:59:06.236: E/GCMDemo(6835): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
06-01 16:59:06.236: E/GCMDemo(6835): at java.lang.Thread.run(Thread.java:856) 
06-01 16:59:06.236: D/GCMDemo(6835): Sleeping for 2225 ms before retry 
06-01 16:59:08.458: D/GCMDemo(6835): Attempt #2 to register 
06-01 16:59:08.468: V/GCMDemo(6835): Posting 'regId=APA91bGUjtR-6HtiYBLQ0d4xwNxLeBOpuaTfjJhbLmsH5DUX7whMZ9W8GnHRDycp-AhWc67xGAAlcGQEQdMCNTLCj4N0b5zDIBfWa-e1okPaccwQ-ZMheyriA1_gkfs6XjIM_gO68181yToP7qGDgvXrJiVGPpBadHOd_X0Z9qFJEtYan4kaFls' to http://gcmdemoramesh.appspot.com//register 
06-01 16:59:09.028: E/GCMDemo(6835): Failed to register on attempt 2 
06-01 16:59:09.028: E/GCMDemo(6835): java.io.IOException: Post failed with error code 404 
06-01 16:59:09.028: E/GCMDemo(6835): at com.google.android.gcm.demo.app.ServerUtilities.post(ServerUtilities.java:169) 
06-01 16:59:09.028: E/GCMDemo(6835): at com.google.android.gcm.demo.app.ServerUtilities.register(ServerUtilities.java:66) 
06-01 16:59:09.028: E/GCMDemo(6835): at com.google.android.gcm.demo.app.DemoActivity$2.doInBackground(DemoActivity.java:79) 
06-01 16:59:09.028: E/GCMDemo(6835): at com.google.android.gcm.demo.app.DemoActivity$2.doInBackground(DemoActivity.java:1) 
06-01 16:59:09.028: E/GCMDemo(6835): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
06-01 16:59:09.028: E/GCMDemo(6835): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
06-01 16:59:09.028: E/GCMDemo(6835): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
06-01 16:59:09.028: E/GCMDemo(6835): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
06-01 16:59:09.028: E/GCMDemo(6835): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
06-01 16:59:09.028: E/GCMDemo(6835): at java.lang.Thread.run(Thread.java:856) 
06-01 16:59:09.028: D/GCMDemo(6835): Sleeping for 4450 ms before retry 
06-01 16:59:13.483: D/GCMDemo(6835): Attempt #3 to register 
06-01 16:59:13.493: V/GCMDemo(6835): Posting 'regId=APA91bGUjtR-6HtiYBLQ0d4xwNxLeBOpuaTfjJhbLmsH5DUX7whMZ9W8GnHRDycp-AhWc67xGAAlcGQEQdMCNTLCj4N0b5zDIBfWa-e1okPaccwQ-ZMheyriA1_gkfs6XjIM_gO68181yToP7qGDgvXrJiVGPpBadHOd_X0Z9qFJEtYan4kaFls' to http://gcmdemoramesh.appspot.com//register 

回答

0

我得到它的工作。問題出在我的服務器項目中的端點位置......它的包名稱是lakshmi.com,而不是google.com。一旦我改變它,它工作正常...

謝謝大家...