GCM NoClassDefFoundError的检查设备/清单时, [英] GCM NoClassDefFoundError when checking device/manifest

查看:174
本文介绍了GCM NoClassDefFoundError的检查设备/清单时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想谷歌云消息集成到我的应用程序。
我在我的onCreate方法如下code。

I'm trying to integrate Google Cloud Messaging into my application. I have the following code in my onCreate method.

    GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this);
    if (GCMRegistrar.getRegistrationId(this).equals(""))
        GCMRegistrar.register(this, "xxxxxxxxxxxx");

我有GCMRegistarar正确导入,我有GCM.jar添加到构建路径和我的清单中设置。我安装到2.2机器人1.每当应用程序启动我碰到下面的崩溃。

I have GCMRegistarar imported properly, I have the GCM.jar added to the build paths and my manifest set up. I am installing onto a 2.2 droid 1. Whenever the application launches I get the following crash.

我的清单如下:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.project"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="android.permission.INTERNET" />

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="8" />

<permission
    android:name="com.my.project.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.my.project.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.my.project" />
        </intent-filter>
    </receiver>

    <service android:name=".GCMIntentService" />

    <activity
        android:name=".Index"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

推荐答案

我结束了复制gcm.jar到libs文件夹,然后在引用gcm.jar到我的构建路径。它的工作现在。

I ended up copying the gcm.jar into the libs folder then referencing that gcm.jar to my build paths. It's working now.

这篇关于GCM NoClassDefFoundError的检查设备/清单时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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