[英]Firebase google-services.json with multiple projects?
For our app I am using two different firebase projects:对于我们的应用程序,我使用了两个不同的 Firebase 项目:
As far as I could see the google-services.json (Android) contains the firebase project information and all related apps (as "client").据我所知,google-services.json (Android) 包含 firebase 项目信息和所有相关应用程序(作为“客户端”)。 Is it supported to add a second "project_info" into this file?
是否支持在此文件中添加第二个“project_info”?
Why don't you try android application flavors, for that Google just included support for flavors on version 2.0 of the play services plugin.为什么不尝试android应用程序风格,因为谷歌刚刚在播放服务插件的2.0版中包含了对风格的支持。 Since this version of the
gradle plugin com.google.gms:google-services:2.0.0-alpha3
由于此版本的
gradle plugin com.google.gms:google-services:2.0.0-alpha3
you can do this你可以这样做
app/src/ flavor1/google-services.json flavor2/google-services.json Version 3.0.0 of the plugin will search for the json file in these locations (considering you have a flavor flavor1 and a build type debug): app/src/flavor1/google-services.json flavor2/google-services.json 插件的 3.0.0 版将在这些位置搜索 json 文件(考虑到你有一个 flavor1 和一个构建类型调试):
/app/src/flavor1/google-services.json
/app/src/flavor1/debug/google-services.json
/app/src/debug/google-services.json
/app/src/debug/flavor1/google-services.json
/app/google-services.json
This worked for me even using flavorDimensions.即使使用了flavorDimensions,这也对我有用。 I have free & paid in one dimension and Mock & Prod in the other dimension.
我在一个维度上有免费和付费,在另一个维度上有模拟和生产。 I also have 3 buildTypes: debug, release and staging.
我也有 3 种构建类型:调试、发布和暂存。
How many google-services.json files will depend on your project's characteristics, but you will need at least one json file for every Google project. google-services.json 文件的数量取决于您的项目特征,但您至少需要为每个 Google 项目提供一个 json 文件。
If you want more details about what this plugin does with these json files, here it is: https://github.com/googlesamples/google-services/issues/54#issuecomment-165824720如果您想了解有关此插件如何处理这些 json 文件的更多详细信息,请访问: https : //github.com/googlesamples/google-services/issues/54#issuecomment-165824720
Link to the official docs: https://developers.google.com/android/guides/google-services-plugin官方文档链接: https : //developers.google.com/android/guides/google-services-plugin
And go here to check the latest version of this plugin: https://bintray.com/android/android-tools/com.google.gms.google-services/view并去这里检查这个插件的最新版本: https : //bintray.com/android/android-tools/com.google.gms.google-services/view
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.