Configure ProGuard and DexGuard

We’ve made it simple to set up ProGuard or DexGuard in your app and receive deobfuscated crash reports. First of all, Fabric uses annotations internally, so add the following line to your configuration file:

-keepattributes *Annotation*

Next, in order to provide the most meaningful crash reports, add the following line to your configuration file:

-keepattributes SourceFile,LineNumberTable

Crashlytics will still function without this rule, but your crash reports will not include proper file names or line numbers.

If you are using custom exceptions, add this line so that custom exception types are skipped during obfuscation:

-keep public class * extends java.lang.Exception

If using DexGuard, also add the following line to your configuration file to keep DexGuard from removing your Fabric API key:

-keepresourcexmlelements manifest/application/meta-data@name=io.fabric.ApiKey

For Fabric to properly de-obfuscate your crash reports, you need to remove this line from your configuration file, or we won’t be able to automatically upload your mapping file:

-printmapping mapping.txt

Exclude Crashlytics with ProGuard

To skip running ProGuard on Crashlytics, just add the following to your ProGuard config file.

-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

This will help speed up your builds so that you can ship and test even faster.

If you’re using a build tool, check out the following sections.


Crashlytics extends your standard Ant tasks to manage uploading ProGuard mappings file. Quickly set up your project by following these steps. If your ant build differs significantly from those provided with the Android SDK, please refer to the comments at the top of the crashlytics_build.xml file.

Using DexGuard? Add these two lines to custom_rules.xml of DexGuard.

<property name="proguard.enabled" value="true"/>
<import file="/dev_app/crashlytics-devtools/crashlytics_build.xml"/>


If you’ve already configured Maven, you’re all set. If ProGuard is configured to put the mappings file somewhere other than target/proguard_map.txt, just use this configuration option for the plugin to specify the location:



Once Gradle is configured, ensure that minifyEnabled=true is set in any flavor you’re using Crashlytics in. Crashlytics automatically uploads the mapping files for reach of your build variants.

Using DexGuard? Just add: apply plugin: 'io.fabric' after the DexGuard and Android plugins are applied.