为什么我的应用程序在代码中没有任何错误后崩溃?

时间:2019-09-24 11:51:47

标签: android-studio crash

我的应用程序立即崩溃。

我检查了我的整个代码,一切似乎都正确

我尝试过:

  1. 清洁项目
  2. 使缓存无效/重新启动
  3. 重建应用程序

这是我的日志:

  

2019-09-24 17:11:22.287 24723-24723/com.example.splash E/LoadedApk: Unable to instantiate appComponentFactory java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path: DexPathList[[zip file "/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/lib/arm64, /system/lib64, /vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.LoadedApk.createAppFactory(LoadedApk.java:226) at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:740) at android.app.LoadedApk.getClassLoader(LoadedApk.java:819) at android.app.LoadedApk.getResources(LoadedApk.java:1041) at android.app.ContextImpl.createAppContext(ContextImpl.java:2360) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5985) at android.app.ActivityThread.access$1200(ActivityThread.java:212) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1806) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6912) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860) Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/base.apk': Bad encoded_value method type size 7 at dalvik.system.DexFile.openDexFileNative(Native Method) at dalvik.system.DexFile.openDexFile(DexFile.java:354) at dalvik.system.DexFile.<init>(DexFile.java:101) at dalvik.system.DexFile.<init>(DexFile.java:75) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354) at dalvik.system.DexPathList.<init>(DexPathList.java:164) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65) at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40) at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:736) ... 12 more 2019-09-24 17:11:22.319 24723-24723/com.example.splash E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.splash, PID: 24723 java.lang.RuntimeException: Unable to instantiate application com.example.splash.FireApp: java.lang.ClassNotFoundException: Didn't find class "com.example.splash.FireApp" on path: DexPathList[[zip file "/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/lib/arm64, /system/lib64, /vendor/lib64]] at android.app.LoadedApk.makeApplication(LoadedApk.java:1078) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6078) at android.app.ActivityThread.access$1200(ActivityThread.java:212) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1806) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6912) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.splash.FireApp" on path: DexPathList[[zip file "/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/lib/arm64, /system/lib64, /vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50) at android.app.Instrumentation.newApplication(Instrumentation.java:1142) at android.app.LoadedApk.makeApplication(LoadedApk.java:1070) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6078)  at android.app.ActivityThread.access$1200(ActivityThread.java:212)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1806)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:6912)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)  Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/com.example.splash-38vvy8h0ek5tJSz1HqPOZg==/base.apk': Bad encoded_value method type size 7 at dalvik.system.DexFile.openDexFileNative(Native Method) at dalvik.system.DexFile.openDexFile(DexFile.java:354) at dalvik.system.DexFile.<init>(DexFile.java:101) at dalvik.system.DexFile.<init>(DexFile.java:75) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354) at dalvik.system.DexPathList.<init>(DexPathList.java:164) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65) at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40) at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:736) at android.app.LoadedApk.getClassLoader(LoadedApk.java:819) at android.app.LoadedApk.getResources(LoadedApk.java:1041) at android.app.ContextImpl.createAppContext(ContextImpl.java:2360) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5985)

2 个答案:

答案 0 :(得分:0)

错误编码

  

encoded_array值错误:无法验证dex文件'/data/app/com.example.splash->38vvy8h0ek5tJSz1HqPOZg==/base.apk':错误encoded_value method type size 7

阅读日志时,您应该检查是否缺少要填充的数组,或者是否存在编码问题...您是否已查看所有文件的编码是否正确?

如果要通过其他活动传递此数组,则应检查两个文档的编码类型是否相同


失踪班

  

com.example.splash。FireApp

您可以检查此名称是否正确,或者清单上可能缺少它?


这部分APK在日志中调用了太多时间

  

-38vvy8h0ek5tJSz1HqPOZg ==

您也应该检查一下。

答案 1 :(得分:0)

尝试禁用proguard,是否有帮助。 proguard和AndroidX出现问题