firebase/firebase-android-sdk

Crashlytics crashes release build with latest AGP 9 alpha

Closed this issue · 2 comments

Environment

  • Android Studio version: Android Studio Narwhal 3 Feature Drop | 2025.1.3
  • Firebase Component: Crashlytics
  • Component version: 3.0.6

android.r8.strictFullModeForKeepRules is enabled by default in latest AGP 9 alphas (see AGP 9 behavior changes) which is causing a runtime crash for release builds:

ava.lang.RuntimeException: Unable to create application MyApp: java.lang.NullPointerException: FirebaseCrashlytics component is not present.
  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7836)
  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2546)
  at android.os.Handler.dispatchMessage(Handler.java:110)
  at android.os.Looper.loopOnce(Looper.java:248)
  at android.os.Looper.loop(Looper.java:338)
  at android.app.ActivityThread.main(ActivityThread.java:9067)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
Caused by: java.lang.NullPointerException: FirebaseCrashlytics component is not present.
  at MyApp.onCreate(r8-map-id-517a7ef736eaefc1cd138de170f05c7d0a6f5c98eb517963437b420334c422c3:20)
  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1381)
  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7830)

To reproduce:

  • checkout this branch
  • run ./gradlew installProdRelease
  • launch the app and see the crash

Workaround:

Add android.r8.strictFullModeForKeepRules=false to gradle.properties.

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Hi @ychescale9, thank you for reaching out. I was able to reproduce the issue using our Android quickstart app for Crashlytics. I noticed that you're not using the latest version of Crashlytics (currently 19.4.4). After updating to Firebase Crashlytics version 20.0.1, the issue was resolved.

Please update to the latest version of Firebase. We always recommend to use the latest version to ensure that you have the latest bug fixes and enhancements. In addition to that, as of Firebase BOM 34.1.0 we stopped releasing the deprecated Kotlin extensions (KTX) module and removed it from the Firebase Android BoM. We recommend that you migrate your app to use KTX APIs from the main module to ensure that you continue to get fixes and can take advantage of changes and new features

That said, I'll be closing this issue now. Let me know if there's any misunderstanding so we can reopen the issue. Thanks!