将 FireBase 应用程序分发与 Jenkins 集成 - 任务“:app:appDistributionRelease”执行失败
Posted
技术标签:
【中文标题】将 FireBase 应用程序分发与 Jenkins 集成 - 任务“:app:appDistributionRelease”执行失败【英文标题】:Integrating FireBase App Distribution with Jenkins - Execution failed for task ':app:appDistributionRelease' 【发布时间】:2020-08-22 05:28:03 【问题描述】:我是 jenkins 服务器的新手,想为此寻求一些帮助和指导,我目前有一个应用程序正在使用 firebase 应用程序分发功能正常运行和构建,它可以在本地运行,并且可以分发我的应用程序我遵循了他们的设置用这个https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=0#authenticate_using_a_service_account。
问题是我想在 jenkins 中自动分发我的应用程序,我已经使用 jenkins 成功构建了一个 apk,但是当我将任务 appDistributionUpload 放在 Gradle Wrapper 任务上时发生了这个错误。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:appDistributionUploadAngelDebug'.
> Could not find credentials. To authenticate, you have a few options:
1. Set the `serviceCredentialsFile` property in your gradle plugin
2. Set a refresh token with the FIREBASE_TOKEN environment variable
3. Log in with the Firebase CLI
4. Set service credentials with the GOOGLE_APPLICATION_CREDENTIALS environment variable
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 57s
211 actionable tasks: 209 executed, 2 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Archiving artifacts
Finished: FAILURE
有没有办法可以在我的 Gradle Wrapper 上添加 GOOGLE_APPLICATION_CREDENTIALS 或如何在我的环境变量上设置服务凭据?谢谢
【问题讨论】:
【参考方案1】:所以您可能没有提交您的应用分发凭据文件。检查您的 .gitignore 文件。
如果你没有提交文件,实际上你做了一件好事,因为不推荐。但是,无论如何,您都必须在 Jenkins 环境中提供此文件。
您可以将此文件写入环境变量中。
【讨论】:
您好,感谢您回答我的问题,请问如何在jenkins的Environtment变量中写入文件?我尝试使用 plugins.jenkins.io/envinject 和 plugins.jenkins.io/build-env-propagator 添加我的 GOOGLE_APPLICATION_CREDENTIALS=$HOME/.jenkins/credkey.json 但无济于事,请帮助我。以上是关于将 FireBase 应用程序分发与 Jenkins 集成 - 任务“:app:appDistributionRelease”执行失败的主要内容,如果未能解决你的问题,请参考以下文章
使用服务帐户凭据模式的 Firebase 分发 android 应用程序的权限被拒绝
Firebase 应用分发:“找不到 APK”(构建 AAB 时)