问题描述
我有2个构建类型的项目.每个构建类型都有特定的 applicationIdSuffix .
I has project with 2 build types.Every build type has specific applicationIdSuffix.
BuildType: dev , applicationIdSuffix
= .dev
BuildType : dev , applicationIdSuffix
= .dev
BuildType:产品, applicationIdSuffix
= .prod
BuildType : prod , applicationIdSuffix
= .prod
在Firebase控制台中,我为构建类型= dev 创建应用程序.
In Firebase console I create application for build type = dev.
结果,我下载了文件 google-services.json
.我把它放在 c:\ myproject \ android \ app \
As result I download file google-services.json
. I put it in c:\myproject\android\app\
在此文件中,"package_name":"com.myproject.dev"
好.工作.
现在我在Firebase中执行相同项目,我需要使用另一个buildType = prod 创建另一个应用程序.
Now I in Firebase for the same project, I need to create another application with another buildType = prod.
结果,我下载了 NEW 文件: google-services.json
.在此文件中,"package_name":"com.myproject.prod"
As result I download NEW file: google-services.json
.In this file "package_name": "com.myproject.prod"
我需要在哪里放置第二个文件 google-services.json ?
Where I need to put this second file google-services.json?
推荐答案
Firebase已经支持这一点,您应该创建一个新项目,然后为每种构建类型(mypackage.prod和mypackage.dev)或flavor添加2个新应用.
Firebase already supports that, you should create a new project, then add 2 new apps for each build type (mypackage.prod and mypackage.dev) or flavor.
完成后,只需导出最后创建的应用程序(dev)的google-services.json,该文件应包含两个应用程序的详细信息,如下所示
Once done, just export the google-services.json of the last created app (dev), the file should contain details of both apps, like the following
"client_info": {
"mobilesdk_app_id": "...",
"android_client_info": {
"package_name": "mypackage.dev"
}
},
"client_info": {
"mobilesdk_app_id": "...",
"android_client_info": {
"package_name": "mypackage.prod"
}
这篇关于安卓.Firebase:不同的applicationIdSuffix.哪里保存google-services.json?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!