Skip to content

tasks.whenTaskAdded in Gradle causes ARCore and Firebase Crashlytics symbol upload to silently fail #1724

@execomrt

Description

@execomrt

SPECIFIC ISSUE ENCOUNTERED

When using tasks.whenTaskAdded in the Gradle build script to dynamically modify task dependencies (e.g., making CMake or external tasks depend on a custom extractNativeLibraries task), ARCore's integration with Firebase Crashlytics silently fails. Crashlytics no longer uploads native symbols and ARCore functionality breaks in subtle ways. This issue seems related to how Gradle task wiring is handled internally, and adding blanket dependsOn calls appears to interfere with ARCore or Crashlytics plugin task graphs.

This does not happen if using preBuild.dependsOn(...) explicitly instead of whenTaskAdded.


VERSIONS USED

  • Android Studio: Meerkat
  • ARCore SDK for Android: 1.42.0

STEPS TO REPRODUCE THE ISSUE

  1. Add the following block to app/build.gradle:

    tasks.whenTaskAdded {
        task -> if ((task.name.contains("external") || task.name.contains("CMake")) && !task.name.contains("Clean")) {
            task.dependsOn(extractNativeLibraries)
        }
    }
  2. Add Firebase Crashlytics support to the project.

  3. Build a release APK or Bundle that includes native code and ARCore support.

  4. Observe that native symbol uploads are missing and/or ARCore behavior breaks unexpectedly.


WORKAROUNDS (IF ANY)

Replace tasks.whenTaskAdded { ... } with an explicit dependency like:

afterEvaluate {
    preBuild.dependsOn(extractNativeLibraries)
}

This avoids interfering with the internal task graph used by ARCore and Crashlytics.


ADDITIONAL COMMENTS

If tasks.whenTaskAdded must be used, it would be helpful for ARCore and Firebase plugins to better guard against task wiring changes or expose safer extension points to hook in native tasks. The current behavior is difficult to debug because the Gradle build completes successfully, but functionality like symbol uploads silently fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions