5
ClassNotFoundException 崩溃分析与解决
source link: https://droidyue.com/blog/2021/06/15/how-to-resolve-android-class-not-found-exception/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
ClassNotFoundException 崩溃分析与解决
Jun 15th, 2021
最近有一次添加工具库,在build.gradle
中增加了依赖引用
implementation('com.gu.android:toolargetool:0.3.0')
当执编译并执行,应用崩溃了,尝试使用adb logcat | grep AndroidRuntime
得到如下的日志
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: com.xxxxx, PID: 20279
E AndroidRuntime: java.lang.RuntimeException: Unable to get provider androidx.lifecycle.ProcessLifecycleOwnerInitializer: java.lang.ClassNotFoundException: androidx.lifecycle.ProcessLifecycleOwnerInitializer
E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:7945)
E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:7481)
E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7372)
E AndroidRuntime: at android.app.ActivityThread.access$2400(ActivityThread.java:251)
E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2280)
E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110)
E AndroidRuntime: at android.os.Looper.loop(Looper.java:219)
E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8387)
E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: androidx.lifecycle.ProcessLifecycleOwnerInitializer
E AndroidRuntime: at java.lang.Class.classForName(Native Method)
E AndroidRuntime: at java.lang.Class.forName(Class.java:454)
E AndroidRuntime: at androidx.core.app.AppComponentFactory.instantiateProviderCompat(AppComponentFactory.java:204)
E AndroidRuntime: at androidx.core.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:83)
E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:7929)
E AndroidRuntime: ... 10 more
E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/data/app/com.xxxxx-NSxAfmNEHDVlvqzppm3ddw==/base.apk"],nativeLibraryDirectories=[/data/app/com.xxxxx-NSxAfmNEHDVlvqzppm3ddw==/lib/arm, /data/app/com.xxxxx-NSxAfmNEHDVlvqzppm3ddw==/base.apk!/lib/armeabi-v7a, /system/lib, /hw_product/lib]]
E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:209)
E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E AndroidRuntime: ... 15 more
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK