简体   繁体   中英

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.

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

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.

try disable task 'crashlyticsUploadDeobs':

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

如果您当时没有互联网连接,那么将会发生什么样的映射将上传到崩溃关系。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM