Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 327
Zbigniew Malinowski Avatar asked Jun 10 '15 11:06

Zbigniew Malinowski


2 Answers

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.

like image 187
plugmind Avatar answered Sep 28 '22 20:09

plugmind


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. :-/

like image 31
PAD Avatar answered Sep 28 '22 18:09

PAD