Firebase应用程序分发无法获取应用程序信息:[400]请求包含多Firebase Android项目安装程序上的无效参数
我有一个Android应用程序,它有两个不同的firebase项目,一个用于调试构建,一个用于发布,它们分别有Firebase应用程序分发无法获取应用程序信息:[400]请求包含多Firebase Android项目安装程序上的无效参数,android,firebase,gradle,firebase-app-distribution,Android,Firebase,Gradle,Firebase App Distribution,我有一个Android应用程序,它有两个不同的firebase项目,一个用于调试构建,一个用于发布,它们分别有googleservices.json文件 app |-src/main/debug | |-google-services.json (Points to Firebase with ID: `myapp-debug`) |-src/main/release | |-google-services.json (Points to Firebase with ID: `myapp-rel
googleservices.json
文件
app
|-src/main/debug
| |-google-services.json (Points to Firebase with ID: `myapp-debug`)
|-src/main/release
| |-google-services.json (Points to Firebase with ID: `myapp-release`)
我有app/build.gradle
设置,以便发布和调试版本都发布到myapp DEBUG
Firebase项目。GOOGLE\u APPLICATION\u CREDENTIALS
环境变量设置为myapp debug
Firebase项目的服务帐户JSON
android {
// ... more configs here
buildTypes/debug {
firebaseAppDistribution {
releaseNotes = "DEBUG"
apkPath = "/path/to/debug.apk"
groups = "qa, devs"
}
buildTypes/release {
firebaseAppDistribution {
appId="myapp-debug" // Force release builds to same debug Firebase project
releaseNotes = "RELEASE"
apkPath = "/path/to/release.apk"
groups = "qa, devs"
}
}
}
}
但是,当我构建应用程序并尝试使用appDistributionUpload*
命令发布时,我得到了一个RELEASEbuild的错误
./gradlew clean assembleDebug
./gradlew assembleRelease
./gradlew appDistributionUploadDebug # This command succeeds
./gradlew appDistributionUploadRelease # This one fails with failed to fetch app information
因此,我对这里可能出现的问题感到困惑。appId
config在firebaseAppDistribution
block中的作用是什么️
以下是每个
AppDistributionPload
命令的日志,以供参考
> Task :ClassifiedsApp:appDistributionUploadDebug
Using APK path specified by the apkPath parameter in your app's build.gradle: /myapp/build/outputs/apk/debug/debug-app.apk.
Uploading APK to Firebase App Distribution...
Getting appId from output of google services plugin
Using credentials file specified by environment variable GOOGLE_APPLICATION_CREDENTIALS: ****
This APK has not been uploaded before.
Uploading the APK.
Uploaded APK successfully 202
Added release notes successfully 200
Added testers/groups successfully 200
App Distribution upload finished successfully!
> Task :ClassifiedsApp:appDistributionUploadRelease FAILED
Using APK path specified by the apkPath parameter in your app's build.gradle: /myapp/build/outputs/apk/release/release-app.apk.
Uploading APK to Firebase App Distribution...
Getting appId from build.gradle file
Using credentials file specified by environment variable GOOGLE_APPLICATION_CREDENTIALS: ****
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ClassifiedsApp:appDistributionUploadRelease'.
> App Distribution failed to fetch app information: [400] Request contains an invalid argument.
我已经联系了Firebase支持团队,支持团队的Kyle已经回复我 我的错误是,基于for
appId
它指的是mobilesdk\u app\u id
,而不是我使用的Firebaseproject\u id
请参阅下面的简化googleservices.json
文件
{
"project_info":{
"project_id":"firebase-project-id"
},
"client":[
{
"client_info":{
"mobilesdk_app_id":"1:543212345:android:93690bfb936b9c",
"android_client_info":{
"package_name":"app.package.name"
}
}
}
]
}
因此,修复方法是在firebaseAppDistribution
块中将mobilesdk_app_id
值用作appId
buildTypes/release {
firebaseAppDistribution {
appId="1:543212345:android:93690bfb936b9c" // Force release builds to same debug Firebase project
releaseNotes = "RELEASE"
apkPath = "/path/to/release.apk"
groups = "qa, devs"
}
}
最好不要公开分享你的应用程序id(如果那是你的真实应用程序id)。@Chintan这是一个假的应用程序id。此外,你可以通过检查任何APK从任何应用程序获取此信息。