android - 如何将 google-services.json 文件放入 android 项目中的自定义位置

标签 android firebase gradle

我正在将 fabric 的 firebase crashlytics 集成到我的 android 项目中,我的项目有很多合作伙伴,我正在为这些来自 android 源集的所有合作伙伴构建输出。

在 firebase 控制台中,我为每个合作伙伴设置了一个调试和发布 2 个项目。所以现在谷歌服务插件为每个合作伙伴搜索 google-services.json 文件,我想将它们(2 个 google-services.json 文件)放到自定义位置。

我可以为这些文件提供谷歌服务插件的自定义位置路径吗?

在构建期间,我可以将这些 json 文件复制到相应的源集,插件将找到它们。

最佳答案

https://developers.google.com/android/guides/google-services-plugin

请注意,如果您有多个包名称,但只有一个文件,您可以向该文件添加更多客户端。

{
  "project_info": {...},
  "client": ["client_info": {..."package_name": "com.blundell.tut"],
  "client": ["client_info": {..."package_name": "com.ataul.tut"],
  "client": [...]
}

即因此,您可以将它们全部放在同一个文件中,而不是自定义位置(如果需要,还可以动态修改文件)。

关于android - 如何将 google-services.json 文件放入 android 项目中的自定义位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55749488/

相关文章:

javascript - 引用错误 : noticication_id is not defined in firebase notification

android - 所有 gms/firebase 库必须使用完全相同的版本规范 Android Studio

javascript - 为什么可观察管道在组件中不起作用?

Android gradle排除模块不起作用

android - 如何使用 Gradle 从命令行构建 Android 应用程序

android - 如何获取安卓手机的电话号码?

android - 汉堡字形 (☰) 在 Android 设备上呈现灰色

android - Gradle - 默认构建类型总是调试

android - 错误 : method gettext() must be call from UI thread is worker

android - 取消使用 setGroup 创建的 Bundle 中的通知