Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
denzap opened this issue Nov 13, 2024 · 1 comment
Labels
api: appdistribution type: bug Something isn't working

Comments

@denzap
Copy link

denzap commented Nov 13, 2024

[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?

@lehcar09
Copy link
Contributor

Hi @denzap, thank you for reaching out and sharing an MCVE. I was able to reproduce the issue you raised. I'll raise this to our engineers and see what we can do here.

As a workaround, for now, I suggest specifying the artifactPath on the command.

./gradlew appDistributionUploadGoogleDebug --artifactPath="<YOUR_BUILD_DIRECTORY>/outputs/apk_from_bundle/googleDebug/app-google-debug-universal.apk"

@lehcar09 lehcar09 added the type: bug Something isn't working label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: appdistribution type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants