Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.IncompatibleClassChangeError inside FirebaseInitProvider.onCreate when starting app with minifyEnabled true

Tested Environment / Dependencies

  • Android Studio: Android Studio Arctic Fox Beta 2 and Bumblebee Canary 1
  • AGP: 7.1.0-alpha01
  • Firebase Analytics: com.google.firebase:firebase-analytics-ktx:19.0.0
  • Firebase Crashlytics: com.google.firebase:firebase-crashlytics-ktx:18.0.0
  • minifyEnabled: true
  • Proguard Config specifically for Firebase: None

What's happening

When I build my app with minifyEnabled = true and try to start the app, app crashes right after it launches with the following crash log:

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)

Notes

  • Configuring minifyEnabled = false fixes the issue and app can start as expected.
  • Maybe it is related or dup of: java.lang.IncompatibleClassChangeError caused by R8 (AGP 7.0.0-beta02).
like image 699
shoheikawano Avatar asked May 29 '21 15:05

shoheikawano


1 Answers

We had similar crashes in release since AGP 7.0.0-alpha12. The crashes are gone after updating the desugaring library to version 1.1.5.

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}

More info: https://issuetracker.google.com/issues/189244205

like image 183
Nieto Avatar answered Oct 10 '22 06:10

Nieto