我一直在更新去年发布的应用。当今天在一个完全不同的活动上修改源代码时,我注意到其中一个活动,与我工作的内容完全无关。它给了我这个错误:
02-08 13:59:53.850: E/AndroidRuntime(11526): FATAL EXCEPTION: main
02-08 13:59:53.850: E/AndroidRuntime(11526): java.lang.NoClassDefFoundError: uk/co/m/panic/MyLocationActivity
02-08 13:59:53.850: E/AndroidRuntime(11526): at uk.co.m.panic.ParentActivity.onItemClick(ParentActivity.java:80)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.widget.AbsListView.performItemClick(AbsListView.java:1108)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.widget.ListView.performItemClick(ListView.java:4760)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2571)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.widget.AbsListView$1.run(AbsListView.java:3284)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.os.Handler.handleCallback(Handler.java:608)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.os.Handler.dispatchMessage(Handler.java:92)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.os.Looper.loop(Looper.java:156)
02-08 13:59:53.850: E/AndroidRuntime(11526): at android.app.ActivityThread.main(ActivityThread.java:5045)
02-08 13:59:53.850: E/AndroidRuntime(11526): at java.lang.reflect.Method.invokeNative(Native Method)
02-08 13:59:53.850: E/AndroidRuntime(11526): at java.lang.reflect.Method.invoke(Method.java:511)
02-08 13:59:53.850: E/AndroidRuntime(11526): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-08 13:59:53.850: E/AndroidRuntime(11526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-08 13:59:53.850: E/AndroidRuntime(11526): at dalvik.system.NativeStart.main(Native Method)
02-08 13:59:53.850: E/AndroidRuntime(11526): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
02-08 13:59:53.850: E/AndroidRuntime(11526): at dalvik.system.DexFile.defineClass(Native Method)
02-08 13:59:53.850: E/AndroidRuntime(11526): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:195)
02-08 13:59:53.850: E/AndroidRuntime(11526): at dalvik.system.DexPathList.findClass(DexPathList.java:315)
02-08 13:59:53.850: E/AndroidRuntime(11526): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:58)
02-08 13:59:53.850: E/AndroidRuntime(11526): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-08 13:59:53.850: E/AndroidRuntime(11526): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-08 13:59:53.850: E/AndroidRuntime(11526): ... 15 more
通常NoClassDefError类似于minfest中缺少的活动。但在这种情况下,它不是。类名没有改变,但我确实更新了我的Android sdk版本所以我不知道这是否有参与...
错误发生在这一行:
Intent myLocationItent = new Intent(ParentActivity.this, MyLocationActivity.class);
答案 0 :(得分:0)
如果您使用.jar
文件,则必须在项目的根目录中添加libs/
文件夹(src/, res/,
旁边等)。检查这种情况。