0

我已经下载了一些 Google 云消息传递示例应用程序。如果我运行我的示例应用程序。不幸的是,gcm-client-demo 已经停止。我遇到了这种问题。

  1. 我有发件人 ID、应用程序密钥和服务器 URL。
  2. 强制我需要为我的模拟器登录谷歌帐户。现在我的模拟器没有
    登录

为什么我面临这个问题请解释我..

日志猫:

02-28 14:48:03.189: D/AndroidRuntime(976): Shutting down VM
02-28 14:48:03.189: W/dalvikvm(976): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
02-28 14:48:03.229: E/AndroidRuntime(976): FATAL EXCEPTION: main
02-28 14:48:03.229: E/AndroidRuntime(976): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gcm.demo.app/com.google.android.gcm.demo.app.DemoActivity}: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.os.Looper.loop(Looper.java:137)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.ActivityThread.main(ActivityThread.java:4745)
02-28 14:48:03.229: E/AndroidRuntime(976):  at java.lang.reflect.Method.invokeNative(Native Method)
02-28 14:48:03.229: E/AndroidRuntime(976):  at java.lang.reflect.Method.invoke(Method.java:511)
02-28 14:48:03.229: E/AndroidRuntime(976):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-28 14:48:03.229: E/AndroidRuntime(976):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-28 14:48:03.229: E/AndroidRuntime(976):  at dalvik.system.NativeStart.main(Native Method)
02-28 14:48:03.229: E/AndroidRuntime(976): Caused by: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
02-28 14:48:03.229: E/AndroidRuntime(976):  at com.google.android.gcm.GCMRegistrar.checkDevice(GCMRegistrar.java:98)
02-28 14:48:03.229: E/AndroidRuntime(976):  at com.google.android.gcm.demo.app.DemoActivity.onCreate(DemoActivity.java:51)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.Activity.performCreate(Activity.java:5008)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
02-28 14:48:03.229: E/AndroidRuntime(976):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
02-28 14:48:03.229: E/AndroidRuntime(976):  ... 11 more
02-28 14:48:03.260: W/ActivityManager(372):   Force finishing activity com.google.android.gcm.demo.app/.DemoActivity
02-28 14:48:03.279: W/WindowManager(372): Failure taking screenshot for (343x201) to layer 21010
02-28 14:48:03.719: I/Choreographer(372): Skipped 39 frames!  The application may be doing too much work on its main thread.
02-28 14:48:03.809: W/ActivityManager(372): Activity pause timeout for ActivityRecord{4125ba80 com.google.android.gcm.demo.app/.DemoActivity}
02-28 14:48:04.718: I/Choreographer(930): Skipped 95 frames!  The application may be doing too much work on its main thread.
02-28 14:48:05.369: I/ARMAssembler(36): generated scanline__00000077:03515104_00008001_00000000 [113 ipp] (134 ins) at [0x41407610:0x41407828] in 8278218 ns
02-28 14:48:06.488: I/ActivityManager(372): No longer want com.android.contacts (pid 544): hidden #16
02-28 14:48:16.499: W/ActivityManager(372): Activity destroy timeout for ActivityRecord{4125ba80 com.google.android.gcm.demo.app/.DemoActivity}
02-28 14:52:21.518: D/dalvikvm(456): GC_CONCURRENT freed 397K, 9% free 6557K/7175K, paused 32ms+13ms, total 125ms
02-28 14:53:03.318: I/Process(976): Sending signal. PID: 976 SIG: 9
02-28 14:53:03.378: I/ActivityManager(372): Process com.google.android.gcm.demo.app (pid 976) has died.
02-28 14:53:03.428: W/InputMethodManagerService(372): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41317c60 attribute=null
02-28 14:53:17.979: E/ThrottleService(372): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
02-28 14:59:57.108: D/dalvikvm(456): GC_CONCURRENT freed 385K, 9% free 6555K/7175K, paused 17ms+9ms, total 98ms
4

1 回答 1

3

听起来好像您的模拟器没有安装 Google API,基于此错误消息:

Device does not have package com.google.android.gsf

您可以在 Google GCM 文档中阅读有关 GCM 客户端要求的信息:http: //developer.android.com/google/gcm/demo.html#requirements

重要的部分是:

对于 Android 应用程序:

  • 使用 Google API 运行 Android 2.2 的模拟器(或设备)。
  • 注册使用 GCM 的帐户的 Google API 项目编号。

因此,当您创建模拟器时,请确保目标已安装 Google API。例如:

Google APIs (Google Inc.) - API Level 10
于 2013-02-28T15:39:41.630 回答