GCM:java.lang.NoClassDefFoundError的:com.google.android.gcm.GCMRegistrar [英] GCM : java.lang.noclassdeffounderror: com.google.android.gcm.GCMRegistrar

查看:212
本文介绍了GCM:java.lang.NoClassDefFoundError的:com.google.android.gcm.GCMRegistrar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用下面的code到注册设备到GCM:

I am trying to register a device onto GCM using the following code:

    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");
    } 

我已经导入进口com.google.android.gcm.GCMRegistrar;
还增加GCM.jar我在Eclipse构建路径,我得到了直通的SDK下载

I have imported import com.google.android.gcm.GCMRegistrar;
and also added GCM.jar to my buildpath in Eclipse which i got thru the sdk download

请帮忙!

推荐答案

在更新ADT(以上ADT 17)你必须把jar文件里面的文件夹,而不是 LIB 。因此,请确保你把 gcm.jar 库文件,而不是 LIB 文件夹。

In the updated ADT(Above ADT 17) you have to put jar files inside libs folder and not lib. So make sure that you put gcm.jar file inside libs and not lib folder.

这篇关于GCM:java.lang.NoClassDefFoundError的:com.google.android.gcm.GCMRegistrar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆