😴 Firebase Crashlytics is a lightweight, realtime crash reporter that helps you track, prioritize, and fix stability issues that erode your app quality. Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them.
If you haven't already, add Firebase to your Android project.
Add below codes to your root build.gradle
file (not your module build.gradle file).
dependencies {
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.0'
}
}
And add a dependency code to your module's build.gradle
file.
plugins {
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
dependencies {
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.4.0'
implementation 'com.google.firebase:firebase-analytics-ktx:18.0.2'
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
}
To finish setting up Crashlytics and see initial data in the Crashlytics dashboard of the Firebase console, you need to force a test crash.
1 -) Click on the 'create error' button and create a crash (1)
create_button.setOnClickListener {
throw RuntimeException("Crash") // Force a crash
}
2 -) Click the 'division by zero' button and create a division by zero crash (2)
division_zero_error.setOnClickListener {
var result = 1/0
}
3 -) Go to the Firebase Crashlytics console and check for crashes
4 -) For crash details, choose one of the crashes