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

App distribution gradle plugin has a footgun when using kts build file #6655

Open
ColtonIdle opened this issue Jan 29, 2025 · 5 comments
Open

Comments

@ColtonIdle
Copy link

Hi.
I hit a very weird bug with firebase app distribution gradle plugin. This issue just wasted like 4 working days of mine due to some weird CI messages of failure where it told me my demo dimension build was built with some properties from my full dimension.

Long story short. I had a build.gradle file that I migrated to build.gradle.kts and after doing so it seemed like the app dist plugin wasn't understanding our config of demo vs full apps

See: https://firebase.google.com/docs/app-distribution/android/distribute-gradle#kotlin_5

  productFlavors {
      create("demo") {
          dimension = "version"
          firebaseAppDistribution {
              releaseNotes = "Release notes for demo version"
              testers = "[email protected]"
          }
      }
      create("full") {
          dimension = "version"
          firebaseAppDistribution {
              releaseNotes = "Release notes for full version"
              testers = "[email protected]"
          }
      }
  }

it was always grabbing the last config for firebaseAppDistribution defined... even though we weren't building for that variant. aka. if i built demo. it was using full config. 😱 this is really scary because had this shipped it could have gone to the wrong people. thankfully i use a different appId postfix so it wouldn't let us upload.

this is fixed by adding the right import import com.google.firebase.appdistribution.gradle.firebaseAppDistribution but im suprised this even compiled. Please try to fix/add warning/add lint rule to prevent someone else from using app dist incorrectly. someone may have actually gone from groovy to gradle and not noticed they have this issue at the moment!

I'm running latest stable of everything (android studio, gradle, agp, firebase bom, and firebase app dist gradle plugin)

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@lehcar09
Copy link
Contributor

Hi @ColtonIdle, thank you for reaching out. I tried reproducing the issue, however I did not encounter the behavior. The demo variant uses the correct configuration.

Below are the versions I used in the build.gradle:

agp = "8.8.0"
kotlin = "2.1.0"
googleFirebaseAppdistribution = "5.1.0"
googleGmsGoogleServices = "4.4.2"

I ran this gradle command to upload:

gradle assembleDemo appDistributionDemoDebug

Can you specify the version of the dependencies you're using and steps to reproduce the issue? Thanks!

@ColtonIdle
Copy link
Author

Hm. It was definitely the culprit (i tried adding and removing the line like 10 times. and the issue went away when the import was added) when i was trying in our (fairly simple) project. let me try to repro in a small sample app as well. give me like a day or so to circle back

@lehcar09
Copy link
Contributor

I'll mark this as needs-info for now. Don't worry if the issue closes due to stale, we can always reopen this once we have new information. Thanks!

@ColtonIdle
Copy link
Author

ColtonIdle commented Jan 31, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants