Found com.google.android.gms:play-services:8.4.0, but version 8.3.0 is needed for the google-services plugin
Make sure that the following line is at the end of the app build.gradle file:
apply plugin: 'com.google.gms.google-services'
Mine was on the top and gradle was defaulting to 8.3.0 instead of what was specified: 8.4.0
My build.gradle files are the same as the ones in the Version conflict updating to 8.4.0
As those previous anweres are only part-wise complete. Here are my three steps which worked fine for me:
-
Put this to the end of your apps
build.gradle
apply plugin: 'com.google.gms.google-services'
-
Set your projects
build.gradle
dependencies to'classpath 'com.google.gms:google-services:2.0.0-alpha5'
-
Set Gradle Version to 2.10
Android Studio: File > Project Structure > Project
@redsonic's answer worked for me.. By simply moving
apply plugin: 'com.google.gms.google-services'
after the dependecies in build.gradle (Module: app)
I'm using Android Studio 1.5.1 with Gradle version 2.10
In case you are using Gradle version older than 2.10 you'll also need to update that by selecting the ProjectName or app directory in the Project tool Windows and pressing F4. This will open Project Structure window, select Project from the menu and update Gradle version to 2.10. Press OK (Android Studio will download it in background).
build.gradle (Project: ProjectName)
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
build.gradle (Module: app)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:8.4.0'
}
apply plugin: 'com.google.gms.google-services'
This is a slight variant of @Lord Flash's answer:
For me it wasn't necessarily that I should place the google services plugin at the bottom of the file it was that it should come before the com.android.application
plugin.
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
Also there are newer binaries than the alpha variants for google-services
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:2.0.0-beta6'
}
}
I'm sure there will be newer ones soon. I found the list of variants here