应用程序引擎(蚀):无法从Android模拟器注册设备端点 [英] app engine(eclipse): can't register device from android emulator to endpoint
问题描述
我刚开始探索与Android App Engine和我跟着一个链接,教我如何建立AAPP引擎连接的Android项目。
https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae
I am just started exploring app engine with android and I followed a link to teach me how to create aApp Engine Connected Android Project. https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae
我跟着正是写于链接,
1)连接创建一个新的应用程序引擎的Android项目
1) Created a new app engine connected android project
2)获取从 HTTPS的项目数量和API密钥:// code.google.com /的API /控制台/#项目
3)在谷歌API的控制台使谷歌云通讯
3) enable Google Cloud Messaging in the Google APIs Console
4)LOCAL_ANDROID_RUN设置为true CloudEndpoints类
4) set the LOCAL_ANDROID_RUN to true in CloudEndpoints class
5)使用仿真器与谷歌API(V17)
5) used a emulator with google api(v17)
6)安装了Android SDK中经理的android云消息库
6) installed the android cloud messaging library from android sdk manager
7)我使用的Eclipse靛蓝
7) I am using eclipse indigo
我开始本地主机:8888和它的作品在网络上完全正常
但是当我运行模拟器和我pssed注册按钮$ P $,它会立即停下来,检查我的logcat,它显示这个错误,我不就是我应该做的。
I started the localhost:8888 and it's work perfectly fine on the web but when I run the emulator and I pressed on the register button , it stopped immediately and I check my logcat, It display this error which I don't what I should do about it
03-26 13:03:48.766: E/AndroidRuntime(915): FATAL EXCEPTION: IntentService[GCMIntentService-525241845095-1]
03-26 13:03:48.766: E/AndroidRuntime(915): java.lang.NullPointerException
03-26 13:03:48.766: E/AndroidRuntime(915): at com.tesst.GCMIntentService.onRegistered(GCMIntentService.java:144)
03-26 13:03:48.766: E/AndroidRuntime(915): at com.google.android.gcm.GCMBaseIntentService.handleRegistration(GCMBaseIntentService.java:251)
03-26 13:03:48.766: E/AndroidRuntime(915): at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:153)
03-26 13:03:48.766: E/AndroidRuntime(915): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
03-26 13:03:48.766: E/AndroidRuntime(915): at android.os.Handler.dispatchMessage(Handler.java:99)
03-26 13:03:48.766: E/AndroidRuntime(915): at android.os.Looper.loop(Looper.java:137)
03-26 13:03:48.766: E/AndroidRuntime(915): at android.os.HandlerThread.run(HandlerThread.java:60)
AP preciate如果有人能帮助我解决,我有我的问题。谢谢
appreciate if anyone can help me solve my issue that I am having. Thanks
推荐答案
看着这个狭义的,它很可能是existingInfo为null。
Looking at this narrowly, it is likely that existingInfo is null.
更广泛地说,它出现在你onRegistered功能执行的端点。对于初学者来说,调用一个端点是同步操作,因此不应该在onRegistered完成。
More broadly, it appears that in your onRegistered function you execute an endpoint. For starters, invoking an endpoint is a synchronous operation so it shouldn't be done in onRegistered.
如果我理解你的code正确,你应该改变这种状况。我建议你应该脱钩从终端code您的GCM code。
If I am understanding your code correctly, you should change that. I would suggest you should 'de-couple' your GCM code from your endpoints code.
另外,我建议你检讨实施GCM的说明:结果
http://developer.android.com/google/gcm/gs.html
Also, I suggest you review the instructions for implementing GCM:
http://developer.android.com/google/gcm/gs.html
这篇关于应用程序引擎(蚀):无法从Android模拟器注册设备端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!