firebase-android-sdk: Task 'uploadCrashlyticsSymbolFileRelease' not found in root/app project

Environment

  • Android Studio version: 3.6.1
  • Firebase Gradle Plugin: 2.0.0-beta02
  • Firebase Component: Firebase Crashlytics NDK
  • Component version: 17.0.0-beta01

Problem

Tasks to upload debug symbols to Crashlytics are not generated.

I have created a template project that Android Studio provides by default and set up Firebase Crashlytics NDK as described here https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk#enable-symbol-uploading. Project successfully compiled (release build type) and appeared in Firebase Console but when I try to call gradlew uploadCrashlyticsSymbolFileRelease there is an error:

Task 'uploadCrashlyticsSymbolFileRelease' not found in root project 'Template'.

or

Task 'uploadCrashlyticsSymbolFileRelease' not found in project 'app'.

Also, I do not forget to add this code to build type release:

buildTypes {
    getByName("release") {
            .....
            firebaseCrashlytics {
                nativeSymbolUploadEnabled = true
            }
            .....
    }
}

Steps to reproduce:

  1. Make template project in android studio
  2. Set up Firebase Crashlytics SDK (https://firebase.google.com/docs/crashlytics/get-started-new-sdk?platform=android)
  3. Set up Firebase Crashlytics NDK (https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk#enable-symbol-uploading)

Expexted results

After assembleRelease command can call gradlew :app:uploadCrashlyticsSymbolFileRelease

Real results

Tasks uploadCrashlyticsSymbolFile<BuildVariant> are not even generated

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I used withGroovyBuilder to work around.

withGroovyBuilder {
    "firebaseCrashlytics" {
        "nativeSymbolUploadEnabled"(true)
    }
}

tldr: you need to case buildType to ExtensionAware for correct behavior, using the following should fix your issues.

buildTypes {
    getByName("release") {
            .....
            (this as ExtensionAware).configure<CrashlyticsExtension> {
                nativeSymbolUploadEnabled = true
            }
            .....
    }
}

The problem is that the way kotlin dsl works is by adding an extension method configure() to all ExtensionAware classes. While BuildType is ExtensionAware at runtime, it is not declared in its definition, as a result kotlin does not call configure() on the buildType, but on the project itself, this results in incorrect behavior.

Please reopen the issue if the above does not solve the problem

I did not find any solution except that I made this piece of code in groovy and imported it into kts. But this also not fully work because Firebase Crashlytics NDK throws NullPointerException. Issue #1357

The problem is really that I use build.gradle.kts instead of build.gradle. I think, that the language (KTS or Groovy) should not affect the creation of tasks and the whole Crashlytics plugin. Also with build.gradle.kts the task generateCrashlyticsSymbolFileRelease always failed with NullPointerException (no message)