Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 can't 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.

like image 274
Fajar Khan Avatar asked Oct 23 '16 08:10

Fajar Khan


People also ask

Can you change package name in Firebase?

Caution: When you register your app with Firebase, make sure to enter the same package name as the app you're distributing. The package name value is case-sensitive and cannot be changed for your app in Firebase after it's registered with your Firebase project.

Can I change package name Android?

Step 1: To rename package name in Android studio open your project in Android mode first as shown in the below image. Step 2: Now click on the setting gear icon and deselect Compact Middle Packages. Step 3: Now the packages folder is broken into parts as shown in the below image.

What is the Android package name?

The package name of an Android app uniquely identifies your app on the device, in Google Play Store, and in supported third-party Android stores.


2 Answers

As Eurosecom commented, you can just add a new Android app to your existing Firebase project with the new package name. After doing this, download the updated google-services.json and add it to your app.

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.

like image 61
Frank van Puffelen Avatar answered Sep 18 '22 15:09

Frank van Puffelen


If you are using Firebase assistant then:

  • Delete your app in the Firebase console in the project settings.
  • Back in Firebase assistant reconnect to the Firebase for any service.
  • It will ask you to sync with the project. Click on Sync.
  • The app with new package will be added and the google-services.json file will be automatically updated.

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

Cheers

like image 30
Sanath Bharadwaj Avatar answered Sep 17 '22 15:09

Sanath Bharadwaj