Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add gms play services 9.0.1, google-services plugin wants 9.0.0

Tags:

I have this in my top-level build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
allprojects {
    repositories {
        jcenter()
    }
}

And in my app-level gradle:

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

dependencies {
    compile 'com.google.android.gms:play-services-ads:9.0.1'
}

And I get this error when sync-ing gradle:

Please fix the version conflict either by updating the version of the google-services plugin […] or updating the version of com.google.android.gms to 9.0.0.

Yet I'm already using 9.0.1, I don't get it.

like image 528
Aissen Avatar asked Jun 01 '16 10:06

Aissen


People also ask

What are basement play services?

The library play-services-basement is a dependency of play-services-base . It was introduced in Google Play Service version 8.1. 0 to help to reduce the size of some other libraries like play-services-ads and play-services-analytics .


1 Answers

That's because you should always put the "apply plugin" clause at the bottom for google-services, since it looks for the already-added dependencies. Do it like this in your app-level gradle:

dependencies {
    compile 'com.google.android.gms:play-services-ads:9.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

This is hidden in the Firebase documentation, but applies even if you don't use Firebase.

Note : Update Google Repository also.

like image 179
Aissen Avatar answered Oct 20 '22 14:10

Aissen