Android Studio Gradle: Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package
Solution 1
"client": [
{
"client_info": {
"mobilesdk_app_id": "9:99999999:android:9ccdbb6c1ae659b8",
"android_client_info": {
"package_name": "[packagename]"
}
}
package_name
must match what's in your manifest file. you can find the google-services.json
file if you look in the example photo below.
Solution 2
Simple and easy. In my case it solved by as below
Make sure your pakage name in mainifests file same as your gradle's applicationId.
Solution 3
Happened to me when switching flavors.
Now you can also use the google-services.json with different flavors.
See https://stackoverflow.com/a/34364376/570168
Solution 4
Solved the problem of getting an exception
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process Make sure to call FirebaseApp.initializeApp(Context) first.
in FirebaseInstanceId.getInstance().getToken()
Check that package_name exactly matches applicationId 1) build.gradle
defaultConfig {
applicationId "build.gradle.exactly.matches.json"
...
}
should exactly match 2) google-services.json
{
"client_info": {
"mobilesdk_app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"android_client_info": {
"package_name": "build.gradle.exactly.matches.json"
....
Solution 5
This exact same error happened to me only when I tried to build my debug build type. The way I solved it was to change my google-services.json
for my debug build type.
My original field had a field called client_id
and the value was android:com.example.exampleapp
, and I just deleted the android:
prefix and leave as com.example.exampleapp
and after that my gradle build was successful.
Hope it helps!
EDIT
I've just added back the android:
prefix in my google-services.json
and it continued to work correctly. Not sure what happened exactly but I was able to solve my problem with the solution mentioned above.
![sean](https://i.stack.imgur.com/hDpnd.png?s=256&g=1)
Comments
-
sean almost 2 years
I am trying to upgrade my google play services dependencies to 8.4.0 by following the example Google gives here, but I am getting the following error ('com.example.exampleapp' is a replacement for my app package name):
Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name 'com.example.exampleapp'
Project build.gradle:
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-alpha3' classpath 'com.google.gms:google-services:2.0.0-alpha3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } }
Module app/build.gradle:
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.exampleapp" minSdkVersion 19 targetSdkVersion 23 versionCode 1 versionName "1.0" } useLibrary 'org.apache.http.legacy' buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:cardview-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.google.android.exoplayer:exoplayer:r1.5.2' compile 'com.google.android.gms:play-services-auth:8.4.0' compile 'com.google.android.gms:play-services-maps:8.4.0' compile('com.mapbox.mapboxsdk:mapbox-android-sdk:3.0.0@aar') { transitive = true } compile files('libs/commons-lang3-3.3.2.jar') } apply plugin: 'com.google.gms.google-services'
gradle-wrapper.properties:
#Fri Jan 01 08:23:56 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Any ideas as to why gradle can't recognize my own app package name?
EDIT:
Ok, I'm getting different errors this time.
Based on the link Shawn Thye provided, I added this to the bottom of app/build.gradle:
apply plugin: 'com.google.gms.google-services'
and leaving everything else what I listed previously I got this error:
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources] /Users/user/Documents/AndroidStudio/ExampleApp/app/build.gradle Error:(1, 1) A problem occurred evaluating project ':app'. > Failed to apply plugin [id 'com.android.application'] > Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in /Users/user/Documents/AndroidStudio/ExampleApp/gradle/wrapper/gradle-wrapper.properties to gradle-2.10-all.zip Information:BUILD FAILED Information:Total time: 0.921 secs Information:1 error Information:0 warnings Information:See complete output in console
and the Gradle console:
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources] Configuration on demand is an incubating feature. FAILURE: Build failed with an exception. * Where: Build file '/Users/user/Documents/AndroidStudio/ExampleApp/app/build.gradle' line: 1 * What went wrong: A problem occurred evaluating project ':app'. > Failed to apply plugin [id 'com.android.application'] > Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in /Users/user/Documents/AndroidStudio/ExampleApp/gradle/wrapper/gradle-wrapper.properties to gradle-2.10-all.zip * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 1.211 secs
So, then I changed gradle-wrapper.properties as requested to "gradle-2.10-all" and got this error:
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources] google-services plugin could not detect any version for com.google.android.gms, default version: 8.3.0 will be used. please apply google-services plugin at the bottom of the build file. :clean :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72311Library :app:prepareComAndroidSupportCardviewV72311Library :app:prepareComAndroidSupportDesign2311Library :app:prepareComAndroidSupportGridlayoutV72311Library :app:prepareComAndroidSupportRecyclerviewV72311Library :app:prepareComAndroidSupportSupportV42311Library :app:prepareComDigitsSdkAndroidDigits192Library :app:prepareComFacebookAndroidFacebookAndroidSdk470Library :app:prepareComGoogleAndroidExoplayerExoplayerR152Library :app:prepareComGoogleAndroidGmsPlayServicesAuth840Library :app:prepareComGoogleAndroidGmsPlayServicesBase840Library :app:prepareComGoogleAndroidGmsPlayServicesBasement840Library :app:prepareComGoogleAndroidGmsPlayServicesMaps840Library :app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library :app:prepareComMapboxMapboxsdkMapboxAndroidSdk230Library :app:prepareComTwitterSdkAndroidTweetComposer102Library :app:prepareComTwitterSdkAndroidTweetUi180Library :app:prepareComTwitterSdkAndroidTwitter1110Library :app:prepareComTwitterSdkAndroidTwitterCore162Library :app:prepareIoFabricSdkAndroidFabric1310Library :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets :app:processDebugManifest :app:fabricGenerateResourcesDebug :app:generateDebugResValues UP-TO-DATE :app:processDebugGoogleServices Found com.google.android.gms:play-services-auth:8.4.0, but version 8.3.0 is needed for the google-services plugin. Found com.google.android.gms:play-services-maps:8.4.0, but version 8.3.0 is needed for the google-services plugin. :app:processDebugGoogleServices FAILED Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 8.3.0. Information:BUILD FAILED Information:Total time: 5.724 secs Information:1 error Information:0 warnings Information:See complete output in console
And the Gradle console:
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources] Configuration on demand is an incubating feature. google-services plugin could not detect any version for com.google.android.gms, default version: 8.3.0 will be used. please apply google-services plugin at the bottom of the build file. Incremental java compilation is an incubating feature. :clean :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72311Library :app:prepareComAndroidSupportCardviewV72311Library :app:prepareComAndroidSupportDesign2311Library :app:prepareComAndroidSupportGridlayoutV72311Library :app:prepareComAndroidSupportRecyclerviewV72311Library :app:prepareComAndroidSupportSupportV42311Library :app:prepareComDigitsSdkAndroidDigits192Library :app:prepareComFacebookAndroidFacebookAndroidSdk470Library :app:prepareComGoogleAndroidExoplayerExoplayerR152Library :app:prepareComGoogleAndroidGmsPlayServicesAuth840Library :app:prepareComGoogleAndroidGmsPlayServicesBase840Library :app:prepareComGoogleAndroidGmsPlayServicesBasement840Library :app:prepareComGoogleAndroidGmsPlayServicesMaps840Library :app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library :app:prepareComMapboxMapboxsdkMapboxAndroidSdk230Library :app:prepareComTwitterSdkAndroidTweetComposer102Library :app:prepareComTwitterSdkAndroidTweetUi180Library :app:prepareComTwitterSdkAndroidTwitter1110Library :app:prepareComTwitterSdkAndroidTwitterCore162Library :app:prepareIoFabricSdkAndroidFabric1310Library :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets :app:processDebugManifest :app:fabricGenerateResourcesDebug :app:generateDebugResValues UP-TO-DATE :app:processDebugGoogleServices Found com.google.android.gms:play-services-auth:8.4.0, but version 8.3.0 is needed for the google-services plugin. Found com.google.android.gms:play-services-maps:8.4.0, but version 8.3.0 is needed for the google-services plugin. :app:processDebugGoogleServices FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 8.3.0. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 5.724 secs
It's asking for the google-services plugin at the bottom of the build file, which it is already, and it's asking me to run 8.3.0 again... which I will do since that's the only thing working right now...
-
sean over 8 yearsThat is giving me a different error: Error:(37, 13) Failed to resolve: com.google.android.gms:play-services-auth:2.0.0-alpha5 Error:(38, 13) Failed to resolve: com.google.android.gms:play-services-maps:2.0.0-alpha5 Warning:Gradle version 2.10 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in...
-
sean over 8 yearsI'm getting the same errors either way. Thanks though!
-
piotrek1543 over 8 yearschange version from
2.8
to2.10
in gradle wrapper, thenFile -:> Invalidate cache/Restart
-
Shawn Thye over 8 years@TangoJLabs no!, this is classpath, not complile library
-
Shubham AgaRwal about 8 yearsSo this is not exactly a answer. I am not downvoting it beacause of your efforts. But if you have a better answer, it will be a great help.
-
Chris - Jr almost 8 yearsThis was the real solution for me! Thanks Hiren.
-
ugali soft almost 8 yearsyaap, since before i was change the package name in manifest only. Thaaankssssssssssssssss
-
Hiren almost 8 yearsMost well come Chris Brother and Zacharia Brother
-
Oleg Ushakov almost 8 yearsExcellent/ Package name was different in my manifest and google-services.json
-
zooter almost 8 yearsexcellent answers. I suspected as such based on the error from processGoogleDebugServices....
-
zooter almost 8 yearsOne follow-up question -- do you actually need to change anything within Google for this?
-
sandeepd almost 8 yearsgoogle-services.json wasn't having the correct package name, in my case.
-
Leonid Ustenko over 7 yearsThanks, it was exactly my case
-
DJphy over 7 yearsThis is the one to check if the above still didnt fix the issue. nice one @Lord Flash
-
X09 over 7 yearsSolved my problem.
-
EagleCode16 about 7 yearsSolved my problem! Thanks!
-
Hossein Mansouri about 7 yearsproblem was here "google-services.json" as you mention... thanks :)
-
Hiren about 7 yearsIf my answer is helpful and true than please mark it as true
-
CaptainNemo about 7 yearsIn my case another google-services.json file was hiding under the app\src\debug folder. Updating it as well as all the others solved the problem
-
Soufiane almost 7 yearsSolved my problem
-
Gowthaman M over 6 years@Hiren Thank you very much bro +1
-
Umair over 4 yearsThankyou, you saved a lot of my time
-
Benjamin Heinke over 3 yearsTo everybody, please check if you need separate google-services.json files. Mine had all the info for 2 product flavors, so I put it at the directory
/app/
and do not have to struggle with all that complicated folder structure.