Protecting Android Applications That Use Crashlytics
With our recent DashO releases, we’ve been working to make our Android support even easier to use. A great example of this is our evolved support for Crashlytics, which is an analytics framework that can provide detailed reports on application crashes from the field.
When applications have been obfuscated, the stack traces will contain obfuscated class and method names. To prevent this from complicating debugging, Crashlytics provides a utility to automatically deobfuscate stack traces, so that the reporting server shows the original class and method names. It does so by reading the map file, which is a file created by the obfuscation tool to pair the obfuscated class and method names with the original names. Crashlytics expects this map file to be in a ProGuard-compatible format, which differs from the DashO map file format.
If you were using Crashlytics with a version of DashO prior to our 8.5, this would likely have caused issues. You might have experienced an error during the Gradle build, from the Crashlytics plugin:
A problem occurred configuring project ':app'. > path may not be null or empty string. path='null'
To resolve this build error, you could add custom scripting to your build.gradle file to call DashO's ConvertMap utility, which could convert the DashO map file into ProGuard format.
After adding the custom scripting, your Gradle build would complete. However, when you viewed your Crashtlyics portal, you still might see obfuscated stack traces:
… Caused by java.lang.ArithmeticException: Could not complete product registration at classes.foobaz.f(Unknown Source) at classes.foobaz.k(Unknown Source) at classes.foobaz.q(Unknown Source) at classes.foobar.a(Unknown Source) at classes.foobar.w(Unknown Source) at com.example.the.crashlyticsexample.MainActivity.forceCrash(Unknown Source) at java.lang.reflect.Method.invoke(Method.java) at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:384) at android.view.View.performClick(View.java:5198) at android.view.View$PerformClick.run(View.java:21147) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95)
In order to ensure that the stack traces appeared in an unobfuscated format, additional settings were required in your dasho.gradle file.
With our 8.5 version, after initially running your Android project through the Wizard, DashO will automatically manage the translation of the map file from DashO map format to ProGuard format, and put it where Crashlytics expects to find it, so that it will be uploaded to the Crashlytics server without any additional configuration.
While DashO continues to support a full range of Java applications, we’ve been paying special attention to our support of Android applications. This is just one of several reasons why you should always stay current with your DashO version.
For more detail about this topic, please refer to our Gradle documentation. You can also contact us at support [at] preemptive.com if you would like help with your project setup.
As always, if you have any questions or feedback on this topic, or any other Support Corner topics, please contact us at support [at] preemptive.com.