当 R8 与现有的 proguard 配置一起启用时,我得到了一个RuntimeException
发布版本。检查“无法验证dex文件乱序annotation_element name_idx”没有运气,我没有在-overloadaggressively
任何地方设置。还尝试根据“Android/java:从 ProGuard 到 R8 的转换/迁移?”禁用 ProGuard。,还是不行。
构建环境如下:
Android Studio : 3.4.1
com.android.tools.build:gradle:3.4.1
android.enableR8=true
android.enableD8=true
android.enableDesugar=true
崩溃日志:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.your.pkg, PID: 25969
java.lang.RuntimeException: Unable to instantiate application com.your.pkg.YourApplication: java.lang.ClassNotFoundException: Didn't find class "com.your.pkg.YourApplication" on path: DexPathList[[zip file "/data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/base.apk"],nativeLibraryDirectories=[/data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/lib/arm64, /data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1069)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5889)
at android.app.ActivityThread.access$1100(ActivityThread.java:202)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1665)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
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:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.your.pkg.YourApplication" on path: DexPathList[[zip file "/data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/base.apk"],nativeLibraryDirectories=[/data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/lib/arm64, /data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/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:1121)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1061)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5889)
at android.app.ActivityThread.access$1100(ActivityThread.java:202)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1665)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:6729)
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:858)
Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/base.apk because: Failure to verify dex file '/data/app/com.your.pkg-GEdf7lpr_eG0NIkHShudhA==/base.apk': Out-of-order entry types: 21a8 then 21a8
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:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2357)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5792)
提前致谢!