gpt4 book ai didi

android - 如何使用 Google Services Gradle 插件在 Circle CI 上测试 android 应用程序

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:28:39 25 4
gpt4 key购买 nike

我正在使用 Google Services Gradle 插件开发 android 应用程序(Firebase 需要它),并且该插件需要 google-services.json。

我认为 json 文件不应该在 git 的控制之下,因为它有一些应该 stash 的值(例如 api_key),但是 Circle CI 需要那个。

如果google-services.json可以查到环境变量,问题就可以解决。(值 stash 在git仓库中,Circle CI可以从环境变量中获取值)。
但是,我无法从 google-services.json 中找到查找环境变量的机制。

我有三个问题。

1) VCS 真的应该忽略 google-services.json 吗?
2) Google Services Gradle Plugin是否有从google-services.json中查找环境变量的机制?
3)是否有其他方式从 Circle CI 引用 google-services.json?

最佳答案

1) 是的,它应该 - 它包含敏感信息,例如您的 API key 。

2)我不这么认为

3) 您可以使用与 https://circleci.com/docs/2.0/google-auth/ 中类似的方法

  • 使用 base64 对您的 google-services.json 进行编码。确保从编码字符串中删除所有空格
  • 把它放到 Circle CI 项目设置的环境变量中(我把它命名为 GOOGLE_SERVICES)
  • 在您的 circle.yml 中将此变量解码为您应用目录中的 google-services.json 文件。就我而言,我使用

    回显 $GOOGLE_SERVICES | base64 --decode > ~/${HOME}/app/google-services.json

关于android - 如何使用 Google Services Gradle 插件在 Circle CI 上测试 android 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39063493/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com