我是靠谱客的博主 愉快曲奇,最近开发中收集的这篇文章主要介绍新建、启动项目报错Unable to instantiate activity ComponentInfo,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
错误内容
1、新建、启动报错如下:
Process: org.simple, PID: 1553
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.simple/org.simple.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "org.simple.MainActivity" on path: DexPathList[[zip file "/data/app/org.simple-a3yDopplzLQ0wZmxCcIVpQ==/base.apk"],nativeLibraryDirectories=[/data/app/org.simple-a3yDopplzLQ0wZmxCcIVpQ==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2841)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.simple.MainActivity" on path: DexPathList[[zip file "/data/app/org.simple-a3yDopplzLQ0wZmxCcIVpQ==/base.apk"],nativeLibraryDirectories=[/data/app/org.simple-a3yDopplzLQ0wZmxCcIVpQ==/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:1180)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Suppressed: java.io.IOException: Failed to open dex files from /data/app/org.simple-a3yDopplzLQ0wZmxCcIVpQ==/base.apk because: Failure to verify dex file '/data/app/org.simple-a3yDopplzLQ0wZmxCcIVpQ==/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)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:678)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:711)
at android.app.LoadedApk.getResources(LoadedApk.java:944)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2303)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5943)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
... 6 more
解决办法
1、排除法最后才发现是okhttp导致的问题
将okhttp的版本从3.14.9改为3.12.6,问题解决。
最后
以上就是愉快曲奇为你收集整理的新建、启动项目报错Unable to instantiate activity ComponentInfo的全部内容,希望文章能够帮你解决新建、启动项目报错Unable to instantiate activity ComponentInfo所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复