Reputation: 3634
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...
Upvotes: 130
Views: 172101
Reputation: 1591
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.
Upvotes: 100
Reputation: 63
1)check the package name is the same in google-services.json file
2)make sure that no other project exist with same package name
3)make sure that there is internet access
4)try syncing project and running it again
Upvotes: 3
Reputation: 14919
In my case, I just had to do
It all then went fine. I still have no clue what happened.
Upvotes: -1
Reputation: 1905
if you run the other type of build(for example sign apk or etc), you must select app type of build then run the projects.
please seen the following image. for run this project we must select "app" in run configuration popup.
Upvotes: 0
Reputation: 333
i had the same problem and just easy solve it make sure the package name for package in mainfest tag inside manifest.xml file and the applicationId in application tag inside gradle app level file has the same package name
in manifest.xml
package="com.example.work"
in gradle app level
applicationId "com.example.work"
hope it help
Upvotes: 3
Reputation: 1941
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"
....
Upvotes: 22
Reputation: 4644
check that, in your "google-services.json" file your package_name is available or not
Upvotes: 3
Reputation: 6819
For fixing:
No matching client found for package name 'com.example.exampleapp:
You should get a valid google-service.json
file for your package from here
For fixing:
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.:
You should move apply plugin: 'com.google.gms.google-services'
to the end of your app gradle.build
file. Something like this:
dependencies {
...
}
apply plugin: 'com.google.gms.google-services'
Upvotes: 15
Reputation: 129
Both times when you write the package name : 1. When you create a new project in Android Studio and 2. When you create a Configuration File
YOU should write it with lowercase letters - after changing to lowercase it works. If you don't want to waste time just go to you .json file and replace com.myname.MyAPPlicationnamE with com.myname.myapplicationname (for every match in the json file).
Upvotes: 0
Reputation: 8566
Just Android studio run 'Run as administrator' it will work
Or verify your package name on google-services.json file
Upvotes: 1
Reputation: 1383
your google-services.json package name must match your build.gradle applicationId (applicationId "your package name")
Upvotes: 5
Reputation: 1
Please verify build.gradle.
defaultConfig {
applicationId "<packagename>"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Verify the package name.It can also cause error.
Upvotes: 0
Reputation: 3629
Add this in project gradle file
classpath 'com.google.gms:google-services:3.0.0'
Upvotes: 2
Reputation: 1721
"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.
Upvotes: 172
Reputation: 9999
If this happened to you after renaming your application package name, then you need to update the following:
1)google-services.json file in your application by looking up in the file for "package_name" attribute and update it with the new package name.
2)Update your application client Credentials in Google Developers Console by going to the Credentials
and selecting your android client key then update the package name as well with the new one.
Hope this will help.
Upvotes: 3
Reputation: 176
This happened to me when my package name wasn't represented in the google-services.json file I downloaded. Open your google-services.json file and make sure there is a client_info object that has a package name that corresponds to your manifests package name.
Make sure the package name in your project manifest is exactly the same in google-services.json file
thanks.
Upvotes: 1
Reputation: 1459
I meet the problem when using Firebase, i think different package cause the problem.
I solved by adding packeage of new app within Firebase Console, and download google-services.json again.
Upvotes: 10
Reputation: 13431
after studying above that package name in manifest file and application id in gradle build file should be same. my issue didn't resolved.
Actually your application id in gradle build file should be same as your package name in google-services.json file. if your google-services.json file has different package name. delete that app from google analytics or firebase console. and get a new file.
Upvotes: 0
Reputation: 10891
For me, I had to check the google-services.json
file and make sure "package_name"
was correctly set to the package name of my android app. The auto generated services file had .backend
appended to it in my case.
Upvotes: 1
Reputation: 7415
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
Upvotes: 36
Reputation: 4284
This happened to me when my package name wasn't represented in the google-services.json file I downloaded. Open your google-services.json file and make sure there is a client_info object that has a package name that corresponds to your manifests package name.
In googleservices.json:
"client": [
{
"client_info": {
"mobilesdk_app_id": "my-app-id",
"android_client_info": {
"package_name": "com.me.android.test.myapp"
}
and in your manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.android.test.myapp" >
You may need to recreate a new google-services.json for your project, which you can create here: https://developers.google.com/mobile/add?platform=android&cntapi=gcm
Upvotes: 5
Reputation: 709
Open google-services.json in android studio we can see a json object, and contain following items in 'client' jsonarray
"client_id": "android:your package name", "package_name": "your package name",
Please verify your package and proceed.
Upvotes: 6
Reputation: 593
I found success using this configuration:
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
//or use
//classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
and
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
using 8.40 Google Play services. Alpha5 & Alpha6 gave the same 2.8 error you had, regardless of the distributionUrl being 2.10
Upvotes: 5
Reputation: 386
I think because your are using play-service 8.4.0
It required
classpath 'com.android.tools.build:gradle:2.0.0-alpha5'
classpath 'com.google.gms:google-services:2.0.0-alpha5'
you may also refer this.
Upvotes: 1
Reputation: 245
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.
Upvotes: 21