Changing the name of a Firebase package

I have a Google Sign-In application integrated with Firebase. I recently changed the name of the application package for the purpose of release. and now this error is executed:

Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name '<Package Name>' 

So, I assume that Firebase cannot recognize the application with the new package name. How to change the name of a Firebase package. I went through the Firebase console, but I can not find the changes to the package settings. Or is there a good way to achieve this, instead of creating a new project again with the package name and code? Any help would be appreciated.

+6
source share
2 answers

As Eurosecom noted, you can simply add a new Android application to your existing Firebase project with a new package name. After that, download the updated google-services.json and add it to your application.

Note that Firebase does not use the actual package name from your Java code, but uses the applicationId from your application build.gradle file:

 defaultConfig { applicationId "com.firebase.hearthchat" 

When you initially create a project in Android Studio, the package name and application identifier will have the same value. But if you reorganize your code into another package, the application identifier will not be updated. This explains why the application will continue to work after such refactoring. But sometimes this can be confusing, so I prefer to keep them in sync.

+10
source

If you are using the Firebase helper, then:

  • Uninstall the application in the Firebase console in the project settings.
  • In the Firebase assistant, reconnect to Firebase for any service.
  • He will ask you to synchronize with the project. Click "Sync."
  • An application with a new package will be added and the google-services.json file will be automatically updated.

Also note that the package name is applicationId in the build.gradle file.

Greetings

0
source

Source: https://habr.com/ru/post/1011617/


All Articles