GCM Android:不幸的是,GCM 演示已停止
Posted
技术标签:
【中文标题】GCM Android:不幸的是,GCM 演示已停止【英文标题】:GCM Android: Unfortunately, GCM demo has stopped 【发布时间】:2012-09-26 20:28:13 【问题描述】:我正在 android 上尝试 GCM 演示应用程序:http://developer.android.com/guide/google/gcm/demo.html。正确执行了所有步骤,但是当我启动应用程序时出现此错误。不幸的是,GCM 演示已停止。
使用模拟器浏览器测试此服务器 URL,我认为它是正确的:
SERVER_URL: = "http://100.81.31.199:8080/gcm-demo";
当我检查 LogCat 时,我看到了这个:
09-26 16:13:22.449: I/ActivityManager(159): START act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.google.android.gcm.demo.app/.DemoActivity u=0 from pid 256
09-26 16:13:22.449: W/WindowManager(159): Failure taking screenshot for (246x410) to layer 21005
09-26 16:13:22.599: D/dalvikvm(639): Not late-enabling CheckJNI (already on)
09-26 16:13:22.619: D/dalvikvm(37): WAIT_FOR_CONCURRENT_GC blocked 0ms
09-26 16:13:22.629: I/ActivityManager(159): Start proc com.google.android.gcm.demo.app for activity com.google.android.gcm.demo.app/.DemoActivity: pid=639 uid=10048 gids=3003, 1028
09-26 16:13:22.740: D/dalvikvm(37): GC_EXPLICIT freed 38K, 4% free 7964K/8259K, paused 6ms+28ms, total 129ms
09-26 16:13:22.759: D/dalvikvm(37): WAIT_FOR_CONCURRENT_GC blocked 0ms
09-26 16:13:22.779: E/PowerManagerService(159): Excessive delay setting brightness: 291ms, mask=2
09-26 16:13:22.899: D/dalvikvm(37): GC_EXPLICIT freed <1K, 4% free 7964K/8259K, paused 4ms+11ms, total 139ms
09-26 16:13:22.899: D/dalvikvm(37): WAIT_FOR_CONCURRENT_GC blocked 0ms
09-26 16:13:23.009: D/dalvikvm(37): GC_EXPLICIT freed <1K, 4% free 7964K/8259K, paused 37ms+7ms, total 116ms
09-26 16:13:23.019: I/Choreographer(159): Skipped 41 frames! The application may be doing too much work on its main thread.
09-26 16:13:23.059: E/PowerManagerService(159): Excessive delay setting brightness: 267ms, mask=2
09-26 16:13:23.179: E/PowerManagerService(159): Excessive delay setting brightness: 110ms, mask=2
09-26 16:13:23.399: E/Trace(639): error opening trace file: No such file or directory (2)
09-26 16:13:23.779: D/dalvikvm(159): GC_CONCURRENT freed 526K, 7% free 11534K/12295K, paused 37ms+92ms, total 1073ms
09-26 16:13:23.859: D/AndroidRuntime(639): Shutting down VM
09-26 16:13:23.859: W/dalvikvm(639): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
09-26 16:13:23.979: E/AndroidRuntime(639): FATAL EXCEPTION: main
09-26 16:13:23.979: E/AndroidRuntime(639): java.lang.RuntimeException: Unable to start activity ComponentInfocom.google.android.gcm.demo.app/com.google.android.gcm.demo.app.DemoActivity: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.os.Looper.loop(Looper.java:137)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-26 16:13:23.979: E/AndroidRuntime(639): at java.lang.reflect.Method.invokeNative(Native Method)
09-26 16:13:23.979: E/AndroidRuntime(639): at java.lang.reflect.Method.invoke(Method.java:511)
09-26 16:13:23.979: E/AndroidRuntime(639): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-26 16:13:23.979: E/AndroidRuntime(639): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-26 16:13:23.979: E/AndroidRuntime(639): at dalvik.system.NativeStart.main(Native Method)
09-26 16:13:23.979: E/AndroidRuntime(639): Caused by: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
09-26 16:13:23.979: E/AndroidRuntime(639): at com.google.android.gcm.GCMRegistrar.checkDevice(GCMRegistrar.java:98)
09-26 16:13:23.979: E/AndroidRuntime(639): at com.google.android.gcm.demo.app.DemoActivity.onCreate(DemoActivity.java:51)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.Activity.performCreate(Activity.java:5008)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
09-26 16:13:23.979: E/AndroidRuntime(639): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-26 16:13:23.979: E/AndroidRuntime(639): ... 11 more
09-26 16:13:23.999: W/ActivityManager(159): Force finishing activity com.google.android.gcm.demo.app/.DemoActivity
09-26 16:13:23.999: W/WindowManager(159): Failure taking screenshot for (246x410) to layer 21010
09-26 16:13:24.259: I/Choreographer(159): Skipped 35 frames! The application may be doing too much work on its main thread.
09-26 16:13:24.519: W/ActivityManager(159): Activity pause timeout for ActivityRecord415724b0 com.google.android.gcm.demo.app/.DemoActivity
09-26 16:13:24.849: I/Choreographer(256): Skipped 46 frames! The application may be doing too much work on its main thread.
09-26 16:13:25.959: I/Process(639): Sending signal. PID: 639 SIG: 9
09-26 16:13:25.969: I/ActivityManager(159): Process com.google.android.gcm.demo.app (pid 639) has died.
09-26 16:13:26.229: W/InputMethodManagerService(159): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@413a39b0 attribute=null
09-26 16:13:26.520: E/BufferQueue(36): [] drainQueueLocked: BufferQueue has been abandoned!
09-26 16:13:35.509: W/ActivityManager(159): Activity destroy timeout for ActivityRecord415724b0 com.google.android.gcm.demo.app/.DemoActivity
有什么线索吗??????
谢谢
【问题讨论】:
【参考方案1】:模拟器可能有错误的目标。 “Android X.Y”目标不包含 Google API。
您应该使用具有“Google API”目标的模拟器。
【讨论】:
以上是关于GCM Android:不幸的是,GCM 演示已停止的主要内容,如果未能解决你的问题,请参考以下文章