测试环境/依赖项
- 安卓工作室:安卓工作室北极狐狸测试版2和大黄蜂金丝雀1
- AGP:7.1.0-alpha01
- Firebase Analytics:com.google.Firebase:Firebase Analytics ktx:19.0
- Firebase Crashlytics:com.google.Firebase:Firebase Crashlytics ktx:18.0.0
- minimyEnabled:true
- 专门针对Firebase的Proguard配置:无
发生了什么
当我用minifyEnabled = true
构建应用程序并尝试启动该应用程序时,应用程序在启动后立即崩溃,并显示以下崩溃日志:
2021-05-29 22:30:37.652 16541-16541/com.my.app.package.name E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.my.app.package.name, PID: 16541
java.lang.IncompatibleClassChangeError: Class j$.util.concurrent.i implements non-interface class e.a (declaration of 'j$.util.concurrent.i' appears in /data/app/~~xxxx==/com.my.app.package.name--xxxxxx==/base.apk!classes2.dex)
at com.google.firebase.components.x.<init>(:37)
at com.google.firebase.components.x.b(:44)
at com.google.firebase.components.n.t(:219)
at com.google.firebase.components.n.j(:138)
at com.google.firebase.components.n.<init>(:91)
at com.google.firebase.components.n.<init>(:45)
at com.google.firebase.components.n$b.e(:360)
at com.google.firebase.c.<init>(:427)
at com.google.firebase.c.p(:299)
at com.google.firebase.c.o(:267)
at com.google.firebase.c.n(:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7242)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6783)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6700)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7660)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
备注
- 配置
minifyEnabled = false
修复了该问题,应用程序可以按预期启动 - 可能与R8(AGP 7.0.0-beta02(引起的java.lang.IncompatibleClassChangeError有关或重复
自AGP 7.0.0-alpha12以来,我们在发布中也发生过类似的崩溃。在将desugaring库更新到版本1.1.5
之后,崩溃就消失了。
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
更多信息:https://issuetracker.google.com/issues/189244205