androidfirebasecrashlytics

Crashlytics gradle plugin 3.0.0 mapping file upload is failing


After updating the Crashlytics Gradle plugin to 3.0.0 it fails with the following:

> Task :androidApp:uploadCrashlyticsMappingFileRelease FAILED

187 actionable tasks: 187 executed
FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':androidApp:uploadCrashlyticsMappingFileRelease' (type 'UploadMappingFileTask').
  - Gradle detected a problem with the following location: '/home/phil/actions-runner/_work/***-mobile/***-mobile/androidApp/build/gmpAppId.txt'.
    
    Reason: Task ':androidApp:uploadCrashlyticsMappingFileRelease' uses this output of task ':androidApp:processDebugGoogleServices' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':androidApp:processDebugGoogleServices' as an input of ':androidApp:uploadCrashlyticsMappingFileRelease'.
      2. Declare an explicit dependency on ':androidApp:processDebugGoogleServices' from ':androidApp:uploadCrashlyticsMappingFileRelease' using Task#dependsOn.
      3. Declare an explicit dependency on ':androidApp:processDebugGoogleServices' from ':androidApp:uploadCrashlyticsMappingFileRelease' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.7/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

It seems like it might be a bug considering a release task probably shouldn't depend on any debug task.

Anyone have a fix/work around for this?

Standard Crashlytics setup as in https://firebase.google.com/docs/crashlytics/get-started?platform=android


Solution

  • Confirmed as an issue with Crashlytics 3.0.x and Google Services: https://github.com/firebase/firebase-android-sdk/issues/5962

    This workaround is working for me:

    project.afterEvaluate {
        tasks.withType<GoogleServicesTask> {
            gmpAppId.set(project.layout.buildDirectory.file("$name-gmpAppId.txt"))
        }
    }
    
    dependencies {
        compileOnly(libs.google.services.lib)
    }
    

    My version catalog looks like this:

    [versions]
    googleServices = "4.4.1"
    
    [libraries]
    google-services-lib = { group = "com.google.gms", name = "google-services", version.ref = "googleServices" }
    
    [plugins]
    google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }