Skip to content

Incorrect path selection for buildType + productFlavor combinations in AGP 8.7.0+ #6506

Open
@denzap

Description

@denzap

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Ladybug | 2024.2.1 Patch 2
  • Firebase Component: App Distribution Gradle Plugin
  • Component version: 5.0.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

My project uses multiple buildType and productFlavor configurations as well as a dynamic feature module. I am using the com.google.firebase.appdistribution Gradle plugin to distribute a universal APK (due to the dynamic feature) through Firebase App Distribution.

To locate the correct APK, I override artifactPath in the AppDistributionExtension. Previously, this worked as expected, setting the appropriate path based on the buildType + productFlavor combination. However, after upgrading to AGP 8.7.0 or above, the artifactPath always retains the value of the last configured combination of buildType + productFlavor. As a result, when publishing to App Distribution, the plugin attempts to locate the APK at an incorrect path.

To illustrate the issue, I am attaching an archive with the project (I removed the dynamic feature setup for simplicity) TestApplication.zip, where two tasks can be run:

  1. ./gradlew :app:packageGoogleDebugUniversalApk - to build the universal APK.
  2. ./gradlew :app:appDistributionUploadGoogleDebug - to attempt to publish it.

If agp = 8.6.1 is specified in gradle/libs.versions.toml, everything works correctly, and the console displays a message like:

Using APK path specified by the artifactPath parameter in your app's build.gradle: some_path/app/build/outputs/apk_from_bundle/googleDebug/app-google-debug-universal.apk.

The subsequent error is expected since I haven’t configured publishing settings for the test.

However, if agp = 8.7.0 is specified in gradle/libs.versions.toml, the console shows a message like:

Using APK path specified by the artifactPath parameter in your app's build.gradle: some_path/app/build/outputs/apk_from_bundle/huaweiStore/app-huawei-store-universal.apk.

Regardless of the variant passed to appDistributionUpload, the plugin always attempts to locate the APK for the huaweiStore variant.

Question:
How can I now set the artifactPath parameter of AppDistributionExtension so that it depends on both buildType and productFlavor?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions