【发布时间】:2014-03-31 13:22:32
【问题描述】:
我试图让 GCM 在我的 Android 应用程序上运行,在调用 GCMRegistrar.register() 后不久我收到了这个奇怪的错误消息(应用程序名称是我不能透露的应用程序的名称) :
java.lang.ClassNotFoundException: Didn't find class
"com.<companyname>.<appname>.GCMIntentService" on path: DexPathList[[zip file
"/system/framework/com.google.android.maps.jar", zip file "/data/app/<app-
name>"],nativeLibraryDirectories=[/data/app-lib/<app.name>,
/vendor/lib, /system/lib]]
AndroidManifest 的(我认为)相关部分:
<service android:name=".GCMIntentService" />
GCMIntentService 类存在于指定路径,我是从谷歌提供的 GCM-Client 项目中复制的文件,所以我不太明白是什么问题。
有什么想法吗?
更新: 我将 GCMIntentService 类移到了以下包中:
com.google.android.gcm.demo.app
不,我收到警告:
Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTRATION
flg=0x10 pkg=com.<company-name>.<app-name>
cmp=com.xitaso.plugsurfing/.GCMIntentService (has extras) } U=0: not found
这是什么意思?
【问题讨论】:
-
您使用的是哪个 IDE? Eclipse 还是 Android Studio?
-
@Thomas Bouron 我正在使用 Eclipse。
-
确保包名正确。
-
@deimos1988 转到项目设置 -> Java 构建路径 -> 订购和导出并确保选中
Android private libraries。 -
@Thomas Bouron 私有库已检查。
标签: android noclassdeffounderror google-cloud-messaging