I'm trying to build my new project, but I get this error:
Error:Execution failed for task ':mobile: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 9.0.0.
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.julia.android.example_project"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes.each {
it.buildConfigField 'String', 'API_KEY', myKey
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1'
...
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
wearApp project(':wear')
}
And
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I tried to move apply plugin: 'com.google.gms.google-services'
at the bottom of my app/build.gradle file, but it didn't work out.
Any ideas, please?
Had this issue earlier today. Just apply the google services plugin before you apply the android application plugin.
Update the following lines:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
to:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
I had the same issue, I solved it looking for all the "build.grade" files in the project to change all the versions from 9.8.0 to 10.0.1 (you can do a search "find in path" to search the 9.8.0 string), I had one missing and this caused the error.
And also the line:
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
must be replaced by:
compile 'com.google.firebase:firebase-appindexing:10.0.1'
To fix this you have to do the following.
First, even if the documentation says "Add this"
dependencies {
compile 'com.google.android.gms:play-services:10.0.1'
}
Don't do it, because that is the whole google play services API, since version 6.5 if I remember correctly google play services is a selective API, it means that you must include only what you need.
Read this page entirely until you read Selectively compiling APIs into your executable.
Second, check that all your version numbers are the same, you can't mix them; check the link before, and choose only what you need.
By the way the class path is
classpath 'com.google.gms:google-services:3.0.0'
Not beta-1 as @JuliaKo said.
P.S. If you speak Spanish, read my post about this here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With