Firebase crashlytics mapping file upload doesn't work

Viewed 2420

I have added firebase crashlytics lib and crashlytics gradle plugin to my project

classpath("com.google.firebase:firebase-crashlytics-gradle:2.3.0")
...
plugins {
   ...
   id("com.google.firebase.crashlytics")
   ...
}
...
implementation("com.google.firebase:firebase-crashlytics:17.2.1")
implementation("com.google.firebase:firebase-analytics:17.5.0")

I explicitly set mappingFileUploadEnabled for my release build types with

getByName("release").apply {
   firebaseCrashlytics.mappingFileUploadEnabled = true
}

But mapping file is unfortunately not uploaded. I verify it in firebase crashlytics console - for my test crashes stacktrace points to Unknown Source:55. Here is what I found in gradle logs:

[DEBUG] [com.google.firebase.crashlytics] Mapping File Upload Enabled: false; id: 00000000000000000000000000000000

So it seems my mappingFileUploadEnabled flag has no effect.
Do I need to do something else to make mapping file upload work?

I also don't see firebaseUpload*ReleaseProguardMapping tasks in my project. Not sure if it is supposed to be created though.

UPDATE

I have tried to create an empty android project from scratch and added firebase-crashlytics there. There it seems to work and I can see uploadCrashlyticsMappingFile tasks created for all build types. So for now it looks like firebase-crashlytics gradle plugin doesn't work correctly for my project and doesn't create tasks it is supposed to create. Does anyone have an idea why?

1 Answers

Today I learned that if you apply firebase-crashlytics gradle plugin declaratively, using the plugins {} block the mapping file upload tasks are not created. In order to make it work I had to apply the plugin imperatively using the legacy apply(..) function. This is what I have in the project now:

apply(plugin = "com.google.firebase.crashlytics")

plugins {
    //other plugins
}

After making this change the mapping file upload works fine.

UPDATE

I figured out that if I move crashlytics plugin to the bottom on my plugins section I have the same effect. Now it looks like:

plugins {
    //all other plugins
    id("com.google.firebase.crashlytics")
}
Related