Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase android distribution won't allow applicationIdSuffix

When running ./gradlew appDistributionUploadDevDebug I get an error saying it can't find the app.

The culprit is having applicationIdSuffix = ".dev" in my dev flavor. Removing it allows the apk to be uploaded, but then the artifact wouldn't be built properly. For the record I plan using only the dev flavor for internal distribution.

I get an error message saying I should enable app distribution, but since this is done on a "firebase project" level and it's done for the main flavor I can't do it again.

* What went wrong:
Execution failed for task ':app:appDistributionUploadDevDebug'.
> App Distribution could not find your app 1:xxxxxxxxx:android:0b3f<xxxxxxxxx>.
  Make sure to onboard your app by pressing the "Get started" button on the App Distribution page in the Firebase console:

        https://console.firebase.google.com/project/_/appdistribution

Documenting this as a bug, I'll add a reply since I found a workaround.

Edit: expanded name of gradlew task that was shortened. Though it works it may make for easier searching.

like image 848
Fabio Avatar asked Oct 12 '25 15:10

Fabio


1 Answers

Workaround: To fix open app/google-services.json and look for the mobilesdk_app_id key for the main package name.

For example in my case I noticed that 1:xxxxxxx:android:0b3f<xxxxxxx> was the value for the package with the .dev suffix, while the main package name (without .dev) shows under 1:xxxxxxx:android:7eb88<xxxxxxxx>

So heading to app/build.gradle, the firebaseAppDistribution block would look like this

firebaseAppDistribution {
     appId = "1:xxxxxxxx:android:7eb88<xxxxxxxx>"

I still think this is a bug in firebase distribution. Sounds like the distribution gradle code is picking the right value, but the distribution server is not compatible.

BTW When the developer wants/needs to have 2 separate firebase projects you need to download 2 separate google-services.json files, and place them in the appropriate flavor folders. I also have a (2nd and 3rd) app that shares a project with that setup, but haven't added firebase distribution yet to check how it behaves.

For reference, my workaround worked while providing a serviceCredentialsFile. I also tried using the web token authentication but my results were inconclusive.

like image 137
Fabio Avatar answered Oct 14 '25 06:10

Fabio