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

Viewed 12871
  • What went wrong: Execution failed for task ':app:processDebugGoogleServices'.

No matching client found for package name 'com.example.myapp '

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

This is a client portion from Google Service.json

"client": [https://stackoverflow.com/questions/66766493/execution-failed-for-task-appprocessdebuggoogleservices-no-matching-clien {

  "client_info": {

"mobilesdk_app_id": "1:110944006455:android:f790b09ad0563a63046ab2",
"android_client_info": {
  "package_name": "com.example.myapp"
}
}

And here is my build.gradle

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.riderapp "
    minSdkVersion 16
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

You can see that the application ID for both is same. Yet I receiver this error:

  • What went wrong: Execution failed for task :app:processDebugGoogleServices

No matching client found for package name 'com.example.myapp'

3 Answers

The application Id for both is not the same. In google services json it says com.example.myapp

But in your buildGradle it's com.example.riderapp

Go to firebase, add your app again with the name used in buildGradle com.example.riderapp, add your SHA-1 debug key to firebase in this step also, then download your json again and remove the old one. And report back what happens.

Note: make sure to keep the new googlejson named exactly google-services.json

change minSdkVersion to 21 in app/build.gradle and change every 'com.example.anything' in your project to you project id (you can find it in project details in firestore)

Solution: As @Huthaifa Muayyad said application Ids are not the same, you can do as he said or the more straightforward way is to change the "package_name" in google-services.json to "com.example.riderapp",

Reason: This error happens when you share your project with your teammate who might have a different project name, so we need to change the package_name to our project name.

Even After this, there might be errors as "ERROR:D8: Cannot fit requested classes in a single dex file (# methods: 97652 > 65536) com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: The number of method references in a .dex file cannot exceed 64K." which you can resolve as said in this answer D8: Cannot fit requested classes in a single dex file by @king mort

Related