UPDATED ANSWER:
The reason for the compiling issue is that version of Gradle and Crashlytics Gradle plug-in is incompatible.
As described here, starting from Crashlytics Gradle plugin version 2.5.0:
The Crashlytics
Gradle plugin is compatible with Gradle v5.6.4+ and the Android Gradle
plugin v3.4.2+. Support for previous Gradle and Android Gradle plugin
versions have been removed.
So, the Solution is to use the latest Gradle
and firebase-crashlytics-gradle
versions. Thanks to @Mher for describing the compatible up-to-date versions here. Follow his answer for updating versions. Don't forget to change compileOptions in app level build.gradle as:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Warning: My old answer below is a workaround to fix the Gradle and Crashlytics compatibility for those who are not ready to update the Gradle version. The proper solution is to update the Gradle version. In the old answer below, the mentioned firebase-crashlytics-gradle:2.4.1
was buggy for me and it was not able to upload mapping files to the Firebase console which deobfuscates the crash reports. So, try to follow the above-updated answer instead of downgrading the Crashlytics Gradle version.
OLD ANSER FOR WHO CANNOT UPDATE THE GRADLE VERSION:
I hit the exact same issue. Seems the latest crashlytics-gradle plugin is incompatible with something. Using the lower version of crashlytics-gradle plugin helped. Instead of firebase-crashlytics-gradle:2.6.0
Try to use this version:
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
That worked for me... If that doesn't work for you, you can maybe try even lower versions. A list of versions can be found here:
https://firebase.google.com/support/release-notes/android#crashlytics_gradle_plugin_v2-0-0
When you search for "Crashlytics Gradle plugin version", you can see all released versions for Crashlytics Gradle plugin.
I also had to change compileOptions in app level build.gradle as:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
When target and source compatibility was not set to 1_8, project compiled but was crashing when trying to run the app:
--------- beginning of crash
2021-06-09 17:22:28.765 29519-29519/com.resmed.myair.cpl E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.resmed.myair.cpl, PID: 29519
java.lang.BootstrapMethodError: Exception from call site #45 bootstrap method
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoClassDefFoundError: Invalid descriptor: minimize.
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)