今天研究下android平台下的消息推送,有现成的开源项目androidpn ,按照介绍试了下,但是却报某各类找不到。把引用到的包lib改成libs也不管用,后来把依赖到的jar从buildpath中移除(右键->remove from buildpath),然后在项目上面右键->Android Tools->fix project properties,完事,问题解决之。
以下是错误log
E/AndroidRuntime(525): java.lang.NoClassDefFoundError: org.androidpn.client.PersistentConnectionListener E/AndroidRuntime(525): at org.androidpn.client.XmppManager.<init>(XmppManager.java:98) E/AndroidRuntime(525): at org.androidpn.client.NotificationService.onCreate(NotificationService.java:115) E/AndroidRuntime(525): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2780) E/AndroidRuntime(525): at android.app.ActivityThread.access$3200(ActivityThread.java:119) E/AndroidRuntime(525): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917) E/AndroidRuntime(525): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(525): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime(525): at android.app.ActivityThread.main(ActivityThread.java:4363) E/AndroidRuntime(525): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(525): at java.lang.reflect.Method.invoke(Method.java:521) E/AndroidRuntime(525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) E/AndroidRuntime(525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) E/AndroidRuntime(525): at dalvik.system.NativeStart.main(Native Method)
注意,虽然在这里http://www.cnblogs.com/hanyonglu/archive/2012/03/16/2399655.html 和这里都有解决方法,但是对于我的不管用(adt 20)http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17/comment-page-1#comment-4346