Closed mandrachek closed 1 year ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
If I downgrade the appdistribution plugin to 3.1.0, I get a different error:
App Distribution halted because it had a problem uploading the APK: [404] Requested entity was not found.
Hi @mandrachek, thanks for reporting. While we investigate this, any chance you could provide a minimal reproducible example of your issue? It'll greatly help us investigate this further. Thanks!
@argzdev I explained how to setup a project to reproduce. You can use https://github.com/mandrachek/FirebaseDistributionExample but will need to configure your own firebase project, add the google-services.json, copy your debug keystore, and add your firebase service credentials.
Hi @mandrachek, sorry for the delayed response here. I was able to reproduce the same behavior. That said, this seems to be similar to #4013. One of the solutions recommended here was:
caching values.xml between build stage to the firebase stage does resolve the issue with missing appId.
Could you try that and see if that works for you? Thanks!
@argzdev Not sure what you mean by "caching values.xml between build stage to the firebase stage". There's no example code on that tick on how to perform that. AFAIK, gradle doesn't have stages, it has tasks - not clear at all on how to do what you're asking.
@argzdev I noticed that what's called firebase stage
on that ticket (./gradlew assembleDebug appDistributionUploadDebug
), which the author of the ticket claims works. With the addition of the flavor, e.g., ./gradlew assembleDevDebug appDistributionUploadDevDebug
, it does not work.
Oh my gosh. I tried adding --appId on the command line and specifying it that way. That too failed, but came up with an apparently useful error message:
App Distribution could not find your app ${appId}." 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
So I went to the app in app distribution, and sure enough there was a "Get started" button. Clicked it, and now ./gradlew appDistributionUploadDevDebug
works just fine. So the error message when manually specifying the appId is correct, and useful, but the error message when using the values.xml is misleading and unhelpful.
I'm glad you were able to resolve your issue, @mandrachek. I agree, the error message should be updated, even I got confused what was wrong here. And thanks for the follow up! I'm sure this'll help a lot of our fellow developers in the future once the error message is updated. I'll notify our engineers to have the error message fixed.
@argzdev Why is that manual action "Get started" needed? Even after setting up the whole Firebase project and app distribution using CLI, the developer has to open the project page and dismiss a completely unhelpful landing page.
Hi @bearlysophisticated, this is due to a Terms of Service check, but it's an area that we'd like to simplify in the future.
Hi @mandrachek
Thanks for the report and you patience while we worked on this.
The error message should be improved with version 3.2.0 of the plugin.
@bearlysophisticated We're working on making onboarding simpler - hopefully making the detour via the Firebase Console and pressing a button unnecessary.
@kaibolay Thanks, this is much better!
I noticed that the URL in the error message has an underscore _
in place of the project id: https://console.firebase.google.com/project/_/appdistribution
. Could you fix this as well ,so it points to the absolute location of the distribution page?
@bearlysophisticated Unfortunately (and surprisingly) it's not straightforward to replace that _
with an actual project id. The reasons are arcane: We'd need to translate the project number to a project id which would require an RPC which could fail. Also, we'd have to trust the project number (or app id) passed in as an argument - and that could be wrong - causing the link we'd output to be wrong.
So instead of trying to make that link more specific we'll focus our energy on making the click on ""Get started" obsolete - which in turn will make the link obsolete.
[READ] Step 1: Are you in the right place?
I believe this is the correct location. If it is not, please point me in the proper direction.
[REQUIRED] Step 2: Describe your environment
Android Studio version: Android Studio Dolphin | 2021.3.1 Patch 1 Build #AI-213.7172.25.2113.9123335, built on September 29, 2022 Runtime version: 11.0.14.1+1-b1751.46 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.1
Firebase Component: firebase-appdistribution-gradle
Component version: 3.1.1
Gradle version: 7.6
Android Gradle Plugin Version: 7.3.1
Google Services Gradle plugin version: 4.3.14
[REQUIRED] Step 3: Describe the problem
Unable to deploy the build to firebase. This is the output:
Steps to reproduce:
Create a new app, ensure gradle is up to date. Add signingConfigs, buildTypes, and product flavors. Add google services gradle plugin Create firebase project and add apps for all your versions (e.g., $packageName.$flavorSuffix and $packageName.$flavorSuffix.debug) Download google-services.json file, place it app folder. Add firebase-appdistribution gradle plugin.
Project is configured to use google play services, and firebase app distribution with authentication via a serviceCredentialsFile.
2 build types, release and debug, and several product flavors (dev, qa, staging, and prod). All combinations are registered in firebase (com.app.type.flavor + com.app.flavor.debug).
run
./gradlew assembleDevDebug appDistributionUploadDevDebug
The google-services.json file is located in app/, and google services generates
app/build/generated/res/google-services/dev/debug/values/values.xml
- this contains an entry forgoogle_app_id
, which has the proper appId from google-services.json.For some reason the appDistributionUploadDevDebug task fails to read the value. It doesn't matter if I run the assemble and distribution together, or as separate steps - the same error occurs.
Relevant Code:
top level build.gradle:
app build.grade: