Crashlytics for Android: Disable automatic upload of mapping file via Gradle build

4.9k views Asked by At

I'd like to use crashlytics in our app, but I'm not allowed to upload it's proguard mapping file anywhere to the outside world (company policy). Is it possible to use Crashlytics but with obfuscated stacktraces?

In io.fabric plugin's docs I've found this option:

ext.enableCrashlytics = false

But it disables whole reporting, so that's not what I want.

6

There are 6 answers

5
PAD On

They have everything planned ! ;-) According to this link : "Crashlytics automatically de-obfuscates stack traces for your reports", so you shouldn't have to worry about it.

Simply obfuscate your app with ProGuard, don't forget to update ProGuard rules to avoid unexpected crashes with release app, and it should be ok !

(help page is about Eclipse, but I used Crashlytics with Android Studio just some days ago, and it works fine too)

EDIT 1 : and according to the very end of this second link, Crashlytics automatically upload mapping file during build. It seems you aren't able to disable this.

EDIT 2 : maybe if you use Ant, you would be able to customize (at least a bit) build rules, thanks to crashlytics_build.xml and crashlytics_build_base.xml files. But I'm not used to Ant, and even there, when I read file, it seems the "mapping files auto upload" can't be disabled. :-/

1
Roger Garzon Nieto On

Add to app build Gradle file

firebaseCrashlytics {
        mappingFileUploadEnabled false
    }

https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android

0
chirag sharma On

if you does not have internet connect at that time what will happened mapping will upload to crashlytics or not.

0
VVVVfan On

try disable task 'crashlyticsUploadDeobs':

afterEvaluate {
    for (Task task : project.tasks.matching { it.name.startsWith('crashlyticsUploadDeobs') }) {
    task.enabled = false
}}
0
plugmind On

I have added this at the end of app gradle file:

tasks.whenTaskAdded {task ->
    if(task.name.toLowerCase().contains("crashlytics")) {
        task.enabled = false
    }
}

Build log:

> Task :app:crashlyticsStoreDeobsDebug SKIPPED
> Task :app:crashlyticsUploadDeobsDebug SKIPPED

Please note that this disables all crashlytics related tasks. Uploading proguard mapping file by default is some kind of misunderstanding. It is like uploading private key and its password. This file should only be stored in your vault. So I guess it is better to completely disable all their task by default :)

I am just wondering why this is not a big issue for developers.

0
Ali Zarei On