Crash Reporting
To send crash reports, 101XP SDK uses Firebase Crashlytics.
Configure
To use Firebase Crashlytics in Android Studio:
- Add the file google-services.json in the application directory. Please ask your release manager for that file.
- Add Crashlytics plugin and Google Services plugin in the file build.gradle (root-level):
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5'
}
- Add firebase plugin and dependencies in the file app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
dependencies {
implementation 'com.google.firebase:firebase-crashlytics:18.3.7'
}
apply plugin: 'com.google.gms.google-services'
Using (optional)
To send the crash report use method Platform101XP.crashReport(). Pass an exception to the method as the argument.
// Java
try {
// some code
} catch (Exception e) {
Platform101XP.sendCrashReport(e);
}
// Kotlin
try {
// some code
} catch (e: Exception) {
Platform101XP.sendCrashReport(e)
}
To log a message that will appear in a subsequent crash report use method Platform.crashLog(). Pass the message tag and the text message to the method. The message tag and the text message will be shown in the logcat.
// Java
Platform101XP.crashLog("MY TAG", "Show first log !");
// Kotlin
Platform101XP.crashLog("MY TAG", "Show first log !")
Configure NDK (optional)
If you need to send a crash report from ndk, please add the Firebase Crashlytics NDK dependency and add the firebaseCrashlytics extension and make sure to enable the nativeSymbolUploadEnabled flag in the file app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics''
dependencies {
implementation 'com.google.firebase:firebase-crashlytics-ndk:18.3.7'
}
android {
buildTypes {
release {
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
}
}
}
apply plugin: 'com.google.gms.google-services'