Introduction
Firebase
supports capturing exception information of the Android layer and the native layer.
It supports setting Non-fatals and statistically important exception information for analysis.
Access crash statistics
modularbuild.gradle
plugins {
id 'com.google.firebase.crashlytics'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:31.1.1')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
}
root directorybuild.gradle
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
// Add the dependency for the Crashlytics Gradle plugin
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
}
}
This is done, remember to configure google-services.json
the file
Access to C-layer crash statistics
Based on the previous modulebuild.gradle
buildTypes {
release {
// Add this extension
firebaseCrashlytics {
// Enable processing and uploading of native symbols to Firebase servers.
// By default, this is disabled to improve build speeds.
// This flag must be enabled to see properly-symbolicated native
// stack traces in the Crashlytics dashboard.
nativeSymbolUploadEnabled true
strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib'
unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-crashlytics-ndk'
}
Non-fatals
Login failure, try catch and other abnormal information can be uploaded to the platform through Non-fatals for analysis
FirebaseCrashlytics.getInstance().recordException(e)
Can be used with the tool class configuration of the project logUtils
fun w(e: Exception) {
Log.w(TAG, e)
//上报到FireBase
FirebaseCrashlytics.getInstance().recordException(e)
}
material
Official documentation catch C exception
https://stackoverflow.com/questions/65961515/gradleexception-crashlytics-could-not-determine-stripped-unstripped-native-libr