Execution failed for task ':app:processReleaseGoogleServices'. > No matching client found for package name
Asked Answered
R

6

19

Anytime I try to build my project I keep getting this error:

Execution failed for task ':app:processReleaseGoogleServices'.
No matching client found for package name 'com.my.package'

I have made and remade the google-services.json and have used the app and the package com.my.package.

Here's my project build.gradle:

buildscript {
  repositories {
    ...
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-beta6'
    classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    classpath 'io.fabric.tools:gradle:1.+'
    classpath 'com.newrelic.agent.android:agent-gradle-plugin:4.265.0'
    classpath 'com.google.gms:google-services:2.0.0-alpha9'
  }
}
allprojects {
  repositories {
    ...
  }
}
// Define versions in a single place
ext {
  supportLibraryVersion = '23.2.0'
  playServicesVersion = '8.4.0'
}

Here's my app build.gradle:

  apply plugin: 'android-sdk-manager'
  apply plugin: 'com.android.application'
  apply plugin: 'io.fabric'
  apply plugin: 'newrelic'
  apply plugin: 'com.neenbedankt.android-apt'

  android {
    packagingOptions {
      exclude 'LICENSE.txt'
      exclude 'META-INF/LICENSE'
      exclude 'META-INF/LICENSE.txt'
      exclude 'META-INF/NOTICE'
      exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    dexOptions {
      jumboMode true
    }

    lintOptions {
      disable 'InvalidPackage'
      abortOnError false
    }

    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
      applicationId "com.my.package"
      minSdkVersion 15
      targetSdkVersion 23
    }

    buildTypes {
      debug {
        applicationIdSuffix '.debug'
        versionNameSuffix '-DEBUG'
        ...
      }

      staging {
        applicationIdSuffix '.staging'
        versionNameSuffix '-STAGING'
        ...
      }

      release {
        ...
      }
    }
  }

  dependencies {
    compile "com.android.support:support-v4:$rootProject.supportLibraryVersion",
            "com.android.support:support-annotations:$rootProject.supportLibraryVersion",
            "com.android.support:percent:$rootProject.supportLibraryVersion",
            "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion",
            "com.android.support:mediarouter-v7:$rootProject.supportLibraryVersion",
            "com.google.android.gms:play-services-base:$rootProject.playServicesVersion",
            "com.google.android.gms:play-services-cast:$rootProject.playServicesVersion",
            "com.google.android.gms:play-services-gcm:$rootProject.playServicesVersion",
            "com.google.android.gms:play-services-analytics:$rootProject.playServicesVersion",
            ...
            'com.newrelic.agent.android:android-agent:4.265.0',
            'com.android.support:multidex:1.0.0'
    compile 'com.squareup.dagger:dagger:1.2.1'
  }

  apply plugin: 'com.google.gms.google-services'

I've followed the instructions here several times. I am also using my release configuration so there isn't any reason the applicationIdSuffix should be an issue. Also, com.my.pacakage is just a stand-in for my pacakge name. What can I do to resolve this issue?

Rondeau answered 8/3, 2016 at 19:44 Comment(0)
R
0

The problem was actually with NewRelic not with my configuration. I removed it and followed this answer as I was using BuildTypes. Now it compiles as expected.

Rondeau answered 9/3, 2016 at 14:37 Comment(1)
What do you mean by NewRelic ?Verdict
T
12

You need to provide google-services.json for all flavors (release and development etc)

Single google-services.json can have json/data for all flavors. Go to Google Developers Console and regenerate google-services.json file

Update

You can also create separate google-services.json files for flavors

https://developers.google.com/android/guides/google-services-plugin

Tola answered 8/3, 2016 at 19:59 Comment(0)
S
5

Google just included support for flavors on version 2.0 of the play services plugin. Since this version of the gradle plugin com.google.gms:google-services:2.0.0-alpha9

you can do this

enter image description here

For More details please go through below link. If you want more details about what this plugin does with these json files, here it is:

Link to the official docs:

And go here to check the latest version of this plugin:

Ref link.

Subalpine answered 8/3, 2016 at 20:5 Comment(0)
B
4

In my case it solved my problem

      ...  
 "client": [
        {
          "client_info": {
            "mobilesdk_app_id": "yourid",
            "android_client_info": {
              "package_name": "ru.example.app"
            }
          },
       ...

package_name should be same as in applicationId

        defaultConfig {
                applicationId "ru.example.app"
                minSdkVersion 15
                targetSdkVersion 23
                ...
    }
Bessbessarabia answered 9/11, 2016 at 21:15 Comment(0)
R
0

The problem was actually with NewRelic not with my configuration. I removed it and followed this answer as I was using BuildTypes. Now it compiles as expected.

Rondeau answered 9/3, 2016 at 14:37 Comment(1)
What do you mean by NewRelic ?Verdict
A
0

Probably a bit late but I had a similar problem.

It occurred when I initially connected my app to Firebase analytics for some reason it only picked up my "debug" flavor.

I had to log into Firebase, go to the console and select the relevant project and then manually add the additional "release" flavor.

Then I reconnected to Firebase in Android Studio (which automatically updated and downloaded the json file from Firebase into Studio), re-compiled my app and it worked.

Af answered 1/8, 2017 at 6:0 Comment(0)
U
0

I just had a similar issue and realised it was because I had renamed my app and changed my bundleid but had not rerun

flutterfire configure

as I am using Firebase cloud storage. Reconfiguring the app recreated the google-services.json file and fixed my issue so I could then rerun:

flutter build appbundle
Urea answered 18/4, 2023 at 1:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.