项目中存在的activity一直报NoClassDefFoundError异常,问题出在哪里?

印税生活 发布于 2016/03/28 16:08
阅读 2K+
收藏 0

整个项目只有这一个activity会报这个问题,问题在创建intent的第二个参数那里报出来的:

Intent intent= new Intent(SearchActivity.this, ModelInformationalActivity.class);

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/xxkj/xuanxiu/activity/ModelInformationalActivity;
            at com.xxkj.xuanxiu.activity.SearchActivity$1.onItemClick(SearchActivity.java:93)
            at android.widget.AdapterView.performItemClick(AdapterView.java:303)
            at android.widget.AbsListView.performItemClick(AbsListView.java:1151)
            at android.widget.AbsListView$PerformClick.run(AbsListView.java:3065)
            at android.widget.AbsListView$3.run(AbsListView.java:3878)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5539)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxkj.xuanxiu.activity.ModelInformationalActivity" on path: DexPathList[[zip file "/data/app/com.xxkj.xuanxiu-2/base.apk"],nativeLibraryDirectories=[/data/app/com.xxkj.xuanxiu-2/lib/arm64, /vendor/lib64, /system/lib64]]
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
            at com.xxkj.xuanxiu.activity.SearchActivity$1.onItemClick(SearchActivity.java:93)
            at android.widget.AdapterView.performItemClick(AdapterView.java:303)
            at android.widget.AbsListView.performItemClick(AbsListView.java:1151)
            at android.widget.AbsListView$PerformClick.run(AbsListView.java:3065)
            at android.widget.AbsListView$3.run(AbsListView.java:3878)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5539)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
    Suppressed: java.lang.NoClassDefFoundError: com.xxkj.xuanxiu.activity.ModelInformationalActivity
            at dalvik.system.DexFile.defineClassNative(Native Method)
            at dalvik.system.DexFile.defineClass(DexFile.java:230)
            at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:223)
            at dalvik.system.DexPathList.findClass(DexPathList.java:321)
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
            ... 15 more
    Suppressed: java.lang.ClassNotFoundException: com.xxkj.xuanxiu.activity.ModelInformationalActivity
            at java.lang.Class.classForName(Native Method)
            at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
            at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
            ... 14 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

错误如上,清单文件里是有这个activity的

加载中
0
微软技术支持
微软技术支持
AndroidManifest.xml里配置了,但对应的包里却没有这个类。可能是路径配置错了,或类名错了。
0
李天然
李天然

可以试试改成这样 : Intent intent= new Intent(SearchActivity.this, com.xxkj.xuanxiu.activity.ModelInformationalActivity.class);

或者把 ModelInformationalActivity 改个名字,试试.看看是不是runtime的某个jar文件中包含该类导致classloader父类重复加载.

实在不行,也可以试试用action启动activity.

印税生活
也试过了,但是还是不行...
返回顶部
顶部