android - 将 FireBase 应用程序分发与 Jenkins 集成 - 任务“:app:appDistributionRelease”执行失败
问题描述
我是 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 或如何在我的环境变量上设置服务凭据?谢谢
解决方案
所以你可能没有提交你的应用分发凭证文件。检查您的 .gitignore 文件。
如果你没有提交文件,实际上你做了一件好事,因为不推荐这样做。但是,无论如何,您都必须在 Jenkins 环境中提供此文件。
您可以将此文件写入环境变量中。
推荐阅读
- javascript - 表单提交时触发回调
- file-descriptor - 从 ContentResolver 的 openAssetFileDescriptor 方法中获取 NegativeByteArraySizeException 以读取 vCardUri。有什么办法可以解决吗?
- android-things - 如何在启动时自动运行 Android Things 应用程序?
- android - 在片段容器上调用 FragmentTransaction.replace() 会发生什么?
- java - 如何使 Autowired 注释工作?
- r - 如何在 Ubuntu 18.04 上安装 Rmpfr?
- mongodb - MongoDB 指南针 - NaN 文字导致错误?
- angular - 如何在承诺中简化这个有角度的重复代码?
- c# - 在 ubuntu 16 中使用 Wine 安装 MSI 时出错
- c - 当您将学生人数的值输入为 3 时,此 while 循环如何将 3 作为 cnt 的值而不是 2 打印?