I am using this code to track when the app has crashed:
val core = CrashlyticsCore
.Builder()
.listener {
Log.d("***", "Crash happened")
}
.build()
val crashlyticsKit = Crashlytics
.Builder()
.core(core)
.build()
// Initialize Fabric with the debug-location_inactive crashlytics.
Fabric.with(context, crashlyticsKit)
I am testing it with throw NullPointerException()
and with Crashlytics.getInstance().crash()
. None of them calls listener. When the app starts again, this is in the logs:
I/CrashlyticsCore: Initializing Crashlytics 2.6.1.23
I/CrashlyticsInitProvider: CrashlyticsInitProvider initialization successful
D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
I/CrashlyticsCore: Crashlytics report upload complete: SOME-LETTERS-AND-NUMBERS
What am I doing wrong?
EDIT I used code from How to show a Dialog after crash by using Crashlytics? as a template for mine, but it seems that the API has slightly changed (in this answer, it instantiates as a class, but now it is a listener, see docs)