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

错误日志

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.findClass(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一下项目,然后再重新运行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值