我有一个 Android 应用程序,它有 2 个不同的 firebase 项目,一个用于 DEBUG 构建,一个用于 RELEASE,它们google-services.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
设置,以便将 RELEASE 和 DEBUG 构建都发布到myapp-debug
Firebase 项目。GOOGLE_APPLICATION_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*
命令发布时,我收到RELEASE构建错误。
./gradlew clean assembleDebug
./gradlew assembleRelease
./gradlew appDistributionUploadDebug # This command succeeds
./gradlew appDistributionUploadRelease # This one fails with failed to fetch app information
所以,我对这里可能出现的问题感到困惑。appId
config在block里面的作用是什么firebaseAppDistribution
?⁉️
作为参考,这里是每个appDistributionUpload
命令的日志。
> 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.