38

I followed the below link for renaming the package. After renaming when i try to build the projects android studio throws error like.

Android Studio Rename Package

Error:Execution failed for task ':app:processDebugGoogleServices'. No matching client found for package name 'com.example.app'

Community
  • 1
  • 1
Sai
  • 15,188
  • 20
  • 81
  • 121

7 Answers7

90

You have added the Google Play Services plugin to the project, which reads from the google-services.json found in your app module.

The google-services.json contains service configuration data, such as Google Project ID, application package name, etc..

Since the application package name is also stored in that json, it will not match anymore, so you have to create a new application in your Firebase console, and export the new configuration json.

Then replace the google-services.json in your project with the one you have generated.

Daniel Zolnai
  • 16,487
  • 7
  • 59
  • 71
  • Thanks, i already found the issue before your answer anyway a very thank you for your answer, hope it will be useful for some users. – Sai Jan 21 '16 at 12:20
  • Just found out you can integrate firebase straight from android studio and the google.json file will be generated automatically. – Mwongera808 Jun 30 '17 at 13:32
  • @DanielZolnai do I then need to change other stuff such as the AdminSDK key and what not? – payne May 01 '19 at 18:38
  • Sorry, I don't know, I have not used Admin SDK before. If the configuration for the SDK is in the same services JSON then probably not. – Daniel Zolnai May 02 '19 at 06:20
8

I had the same issue when I renamed my package. I created a new Firebase project from firebase console and downloaded the new google-services.json file from the firebase console and replaced it with the old one but still got the same error. Then I checked my build.gradle (App) file it still had the previous package name so I renamed it with the new package name and it worked.

vishal gaware
  • 161
  • 2
  • 7
1

Look for the names of package and created project in firebase must be same

Divyesh Jani
  • 301
  • 3
  • 11
0

This happened to me recently, I don't know if there have been changes in the google-services.json or if my Git somehow made changes to it.

But now the google-services.json needs to have client details for package ID of all the build variants.

So if you are like me and have your google-service.json in the correct folders for your product flavours, and are still getting this error, please check the google-services.json

CanonicalBear
  • 367
  • 8
  • 12
0

Please check applicationId in build.gradle(app) file. It doesn't change automatically after renaming package name. So rename with name package.

android {
    compileSdkVersion 28
    defaultConfig {
        **applicationId "new package name"**
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
Daniel.Wang
  • 2,242
  • 2
  • 9
  • 27
-1

I am facing the same issue. I had changed package name and app id and refracted all class files to new one. But i forgot to change new package name to google-services.json

Pooja Malik
  • 9
  • 1
  • 3
-1

Also, make sure you don't have the old google-services.json file in your app directory or app/src/debug (buildType directory actually)

Arifullah Jan
  • 86
  • 1
  • 8