androidfirebasekotlinandroid-manifestfirebase-crash-reporting

FirebaseCrashlytics.getInstance() is Crashing App In Multi-Process App


After migrating from Fabric Crashlytics to FirebaseCrashlytics SDK, I'm getting some crashes on another Process, not the main one.

When calling FirebaseCrashlytics.getInstance() in Activity with another Process the App just crashes without generating any single Stack Trace or any Log message even there is no Crash Report in Crashlytics.

Firebase Crashlytics Dependency:

implementation 'com.google.firebase:firebase-crashlytics:17.1.1'

Activity Declaration in Manifests:

<activity
        android:name=".view.alarm.AlarmActivity"
        android:process="alarm.process"
        android:screenOrientation="portrait"
        android:showOnLockScreen="true"
        android:showWhenLocked="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
        android:turnScreenOn="true"
        tools:targetApi="o_mr1" />

Test Code:

 try {
     throw RuntimeException("Test Crash")
  }
 catch (e:Exception){
     FirebaseCrashlytics.getInstance().recordException(e)
  }

The First call of FirebaseCrashlytics.getInstance() will crash the App.


Solution

  • You should add

    FirebaseApp.initializeApp(applicationContext)
    

    before accessing

    FirebaseCrashlytics.getInstance()
    

    You can check more at here