小编use*_*955的帖子

GCM:java.lang.noclassdeffounderror:com.google.android.gcm.GCMRegistrar

我正在尝试使用以下代码将设备注册到GCM:

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    GCMRegistrar.checkDevice(this);
    // the following function can be removed when deploying the app
    GCMRegistrar.checkManifest(this);

    final String regId = GCMRegistrar.getRegistrationId(this);
    if (regId.equals("")) {
      GCMRegistrar.register(this, SENDER_ID);
    } else {
      Log.v(TAG, "Already registered");
    } 
Run Code Online (Sandbox Code Playgroud)

我已导入导入com.google.android.gcm.GCMRegistrar;
并将GCM.jar添加到我在Eclipse中的buildpath中,我通过sdk下载获得了

请帮忙 !

android push-notification

20
推荐指数
4
解决办法
2万
查看次数

标签 统计

android ×1

push-notification ×1