您的位置:首页 > 编程语言 > Java开发

Caused by: java.lang.ClassNotFoundException: Didn't find class ""on path: DexPathList[[zip file "/da

2017-08-09 11:30 701 查看
错误日志

java.lang.RuntimeException: Unable to instantiate application maibai.maibai.com.maibai.StaticApplication: java.lang.ClassNotFoundException: Didn't find class "maibai.maibai.com.maibai.StaticApplication" on path: DexPathList[[zip file "/data/app/com.android.maibai-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.maibai-1/lib/arm64, /data/app/com.android.maibai-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:600)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5144)
at android.app.ActivityThread.access$1600(ActivityThread.java:190)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1674)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5969)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:830)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:720)
Caused by: java.lang.ClassNotFoundException: Didn't find class "maibai.maibai.com.maibai.StaticApplication" on path: DexPathList[[zip file "/data/app/com.android.maibai-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.maibai-1/lib/arm64, /data/app/com.android.maibai-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findCl
4000
ass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:993)
at android.app.LoadedApk.makeApplication(LoadedApk.java:595)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5144)
at android.app.ActivityThread.access$1600(ActivityThread.java:190)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1674)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5969)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:830)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:720)
Suppressed: java.lang.ClassNotFoundException: maibai.maibai.com.maibai.StaticApplication
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)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available


这个问题导致打包apk后安装到手机上时,直接闪退,打不开,纠结了好久这个问题。。。

参考了https://stackoverflow.com/questions/19523167/android-classnotfoundexception-didnt-find-class-on-path这个上面的回答,问题就出在

I had the same issue for my project.It happened due to the conflict in android support library version between my project and the library project that i added in my project. Put the same version android support library in your project and library projects you included and clean build… Everything will work…

也就是项目中的 support library 的版本与library中的 support library 版本不一致。我项目中的版本是compile ‘com.android.support:appcompat-v7:26.+’,所以我将library中的版本也改成了compile ‘com.android.support:appcompat-v7:26.+’,问题就解决了。记住!!!修改了之后要先clean一下项目,然后再重新运行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android Exception
相关文章推荐