我是靠谱客的博主 机灵书本,最近开发中收集的这篇文章主要介绍闪退问题记录:Unable to instantiate activity ComponentInfo{xxxxxx.MainActivity},觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
AS 4.0.1 新建的项目,在加入了依赖库后运行程序闪退,错误日志如下
Unable to instantiate activity ComponentInfo{xxxxxx.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "xxxxxx.MainActivity" on path: DexPathList[[zip file "/data/app/xxxxxxx-HfadAphcPqqepDhmjXsavg==/base.apk"],nativeLibraryDirectories=[/data/app/xxxxxx-HfadAphcPqqepDhmjXsavg==/lib/arm64, /system/lib64, /system/vendor/lib64]]
Caused by: java.lang.ClassNotFoundException: Didn't find class "xxxxxx.MainActivity" on path: DexPathList[[zip file "/data/app/xxxxx-HfadAphcPqqepDhmjXsavg==/base.apk"],nativeLibraryDirectories=[/data/app/xxxxx-HfadAphcPqqepDhmjXsavg==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2931)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1620)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:173)
at android.app.ActivityThread.main(ActivityThread.java:6698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
Suppressed: java.io.IOException: Failed to open dex files from /data/app/xxxxxx-HfadAphcPqqepDhmjXsavg==/base.apk because: Failure to verify dex file '/xxxxxxxx-HfadAphcPqqepDhmjXsavg==/base.apk': Bad method handle type 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
解决方案:在 app/build.gralde 的 android 配置下增加
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
最后
以上就是机灵书本为你收集整理的闪退问题记录:Unable to instantiate activity ComponentInfo{xxxxxx.MainActivity}的全部内容,希望文章能够帮你解决闪退问题记录:Unable to instantiate activity ComponentInfo{xxxxxx.MainActivity}所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复