找不到com.google.android.gsf包

找不到com.google.android.gsf包

问题描述:

我想使用新的谷歌云消息传递系统,但我有一些问题。

I am trying to use new Google Cloud Messaging system but I have some problems.

我看了入门文档和审查演示程序;在那之后我申请要求,我的应用程序,然后我创建了一个新的虚拟设备与API 16。

I read Getting Started document and reviewed demo app; after that I applied requirements to my application then I created a new virtual device with API 16.

但是,当我尝试注册我的设备GCM,它失败,因为这行:

But when I try to register my device to GCM, it fails because of this line:

GCMRegistrar.checkDevice(getApplicationContext()); 

在我的logcat看到这些错误:

In logcat I see these errors:

07-05 07:06:31.925: E/AndroidRuntime(691): FATAL EXCEPTION: main
07-05 07:06:31.925: E/AndroidRuntime(691): java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
07-05 07:06:31.925: E/AndroidRuntime(691):  at com.google.android.gcm.GCMRegistrar.checkDevice(GCMRegistrar.java:83)
07-05 07:06:31.925: E/AndroidRuntime(691):  at aero.tav.mobile.genel$4.onClick(genel.java:201)
07-05 07:06:31.925: E/AndroidRuntime(691):  at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
07-05 07:06:31.925: E/AndroidRuntime(691):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-05 07:06:31.925: E/AndroidRuntime(691):  at android.os.Looper.loop(Looper.java:137)
07-05 07:06:31.925: E/AndroidRuntime(691):  at android.app.ActivityThread.main(ActivityThread.java:4745)
07-05 07:06:31.925: E/AndroidRuntime(691):  at java.lang.reflect.Method.invokeNative(Native Method)
07-05 07:06:31.925: E/AndroidRuntime(691):  at java.lang.reflect.Method.invoke(Method.java:511)
07-05 07:06:31.925: E/AndroidRuntime(691):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
07-05 07:06:31.925: E/AndroidRuntime(691):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-05 07:06:31.925: E/AndroidRuntime(691):  at dalvik.system.NativeStart.main(Native Method)

我又增加了gcm.jar到我的类路径;我不知道什么是错的。

I had added gcm.jar to my class path; I don't know what is wrong.

它像你使用了错误的模拟器在我看来。

it seems to me like you're using the wrong emulator.

默认仿真器使用一个普通的Andr​​oid模拟器,没有任何谷歌的包,不能运行所有耍酷的东西如地图,C2DM和各种类的。

The default emulator uses a regular Android emulator that doesn't have any Google packages and can't run all sorts of things like maps, c2dm and all sorts of stuff like that.

您想要做的,就是创建一个新的模拟器,可以支持谷歌的API。

what you want to do, is create a new emulator that can support the Google APIs.

那么,当您运行该项目,选择运行目标名称模拟器谷歌的API(谷歌公司)。

then, when you run the project, choose the emulator that runs the target name Google APIs (Google Inc).

好运。