I've got a problem with my crash reports from Fabric Crashlytics when I enable Dexguard in my project.
I enabled Dexguard in my project and it works pretty well.
Then I followed the instructions in this this page and added the mentioned configurations to enable fabric de-obfuscate my stacktraces and show proper crash reports. Here's how I apply fabric and dexguard plugins in my main module's build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'dexguard'
apply plugin: 'io.fabric'
And here are the configurations in my proguard-project.txt
file:
# Fabric
#############################################################################
-keepattributes *Annotation*,SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-keepresourcexmlelements manifest/application/meta-data@name=io.fabric.ApiKey
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
#############################################################################
And here's how I use proguard-project.txt
in my release build:
buildTypes{
debug{
proguardFile getDefaultDexGuardFile('dexguard-debug-shrink.pro')
proguardFile 'proguard-project.txt'
}
release{
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'proguard-project.txt'
proguardFile 'dexguard-project.txt'
if(new File("$projectDir/../local.properties").exists()){
signingConfig signingConfigs.release
}
}
}
But when a crash is encountered in the release build the file name in which the crash has occurred is missing, but everything else is working correctly and the stacktrace is almost understandable. Here's a sample crash report:
As you can see in the crash report, only the file name is missing in the stacktrace. The other descriptions like line numbers and method names are completely OK.
Although using the complete method names like ir.X.ui.XMainActivity.throwSomething
and the line numbers in front of the Unknown Source
, I can conclude the file name in which the error has occured, I'd like my stacktraces to show the file names and be completely descriptive themeselves. I've tried many options and many trials and errors but the problem still exists.
Is there anything I'm missing? How can I solve this problem?
I'm using version 8.1.0.7
of Dexguard, version 1.21.7
of Fabric plugin and version 2.9.0
of Crashlytics library.
I updated the Fabric plugin to version 1.25.1
and the Crashlytics library to version 2.9.1
but the problem still exists.
I updated the Fabric plugin to version 1.25.2
, build tools version to 27.0.3
, and gradle plugin version to 3.1.0
but the problem still exists.
What about NSExceptions? What about NSExceptions? This guide describes how to customize your crash reports using the Firebase Crashlytics SDK. By default, Crashlytics automatically collects crash reports for all your app's users (you can turn off automatic crash reporting and enable opt-in reporting for your users instead).
If your project uses Crashlytics alongside the Google Mobile Ads SDK, it's likely that the crash reporters are interfering when registering exception handlers. To fix the issue, turn off crash reporting in the Mobile Ads SDK by calling disableSDKCrashReporting.
Note: When data collection is disabled, Crashlytics will store crash information locally on the device. If data collection is subsequently enabled, any crash information stored on the device will be sent to Crashlytics for processing.
Because Crashlytics only sends the logged error report on the next app launch and must limit the amount of space allocated for logs on disk, it is possible to log enough after an NSError is recorded so that all relevant logs are rotated out by the time Crashlytics sends the report from the device.
You can take following steps for deobfuscated crash reports. As quoted from firebase crashlytics documentation
1. To preserve the info Crashlytics needs for readable crash reports, add the following lines to your config file:
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
2. To let Crashlytics automatically upload the ProGuard or DexGuard mapping file, remove this line from the config file:
-printmapping mapping.txt
Dexguard encrypt the code and obfuscated the files and crash reports
According to Question, Everything defined correctly which enables crash reports, Nothing to change. In My Project Scenario also same, using Dexguard With Fabric.
When integrating Dexguard in Project, Dexguard encrypt the code and obfuscated the files and crash reports for other libraries.
How ever, if you're using google Firebase Crashlytics also, you can't able to see the log in Firebase Console. You will get the Same Report which Fabric provided.
These Crashlytics will provide the crash reports in Google Console. you check the crash log's in ANR & Crashes Section in Android Vitals.
That section shows all ANRs & crashes collected from Android devices whose users have opted in to automatically share usage and diagnostics data. Anomalies can only be detected for non-obfuscated stack traces.
Google Explained about this section https://support.google.com/googleplay/android-developer/answer/6083203
Follow the below steps to get the stack traces properly in Crashlytics
Check this link: https://support.google.com/googleplay/android-developer/answer/6295281?hl=en
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With