Fajar Khan Fajar Khan - 1 month ago 115
Android Question

Changing Firebase Package Name

I have a app with google sign in integrated with firebase. i recently changed app package name for release purpose. and now running throwing this error:

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


so i am guessing firebase cant recognize app with the new package name. How can i change firebase package name. i have gone through firebase console but cant find any changing package settings. or is there any good way to achieve this instead of creating new project with package name and code again? Any help would be appreciated.

Answer

As Eurosecom commented, you can just add a new Android app to your existing Firebase project with the new package name.

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

defaultConfig {
    applicationId "com.firebase.hearthchat"

When you initially create a project in Android Studio, the package name and application id will have the same value. But if you refactor your code into a different package, the application id won't be updated. That explains why the app will continue to work after such a refactoring. But it can be confusing at times, which is why I prefer keeping them in sync.