问题
My current environemnt already has a google-services.json file and everything works. But now due to unforeseen circumstance i must rename the package of my project. I have successfully renamed the package now. I also went into the google-services.json file and renamed the package name there as well. So now i am wondering do i need to go back onto the google developer site and create a new configuration file ?
Basically i am concerned that renaming the package namein google-services.json is not sufficient. i think that configuration is tied to the original package name. I am wondering when a developer renames the package name of a project is it necesaary to generate a new configuration file from google developer site ?
Here is the google-services.json file i originally generated and i'll show you how i changed the package name :
{
"project_info": {
"project_number": "987654321",
"project_id": "firebase-project_myapp"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:234567:android:1011212314151617",
"android_client_info": {
"package_name": "com.NewPackageName" //i updated package name
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "adlskfjsd;fjkalskdjfalk;sdfj"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}
Again is it sufficientn to to only update package_name in the json file or do i need to create all new projects for my app ?
回答1:
Changing the package name in the google-services.json file will not work as it does not act as an update mechanism of any sort but merely a repository of data to be used during services instance establishment.
Yes, it is necessary to create a new configuration file by creating a new application or by deleting the current application in the console you can re-use the application name originally used. This is because each google services instance are generated specifically for a particular application tied to the package name with specific identifiers. So it is an absolute necessity to create a new application and use the google-services.json file from that application settings.
回答2:
We need add an app in firebase-console inside the project with new package name and then download and replace that json in the project directory.
Worked for me!
来源:https://stackoverflow.com/questions/41212751/google-services-json-changed-package-name-do-i-need-to-create-a-new-configur