Gradle sync fails - play-services-measurement-base

56,236

Solution 1

I had the same exact error, upgrading analytics was the key:

implementation 'com.google.android.gms:play-services-analytics:16.0.0'

I know you thought everything is updated referring to the official website, but writing 15.0.0 and looking for suggestions works better.

Solution 2

I just added right after the apply plugin: 'com.google.gms.google-services' at the bottom of my build.gradle :

apply plugin: 'com.google.gms.google-services'
// Work around
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Solution 3

this shoud be on top if you use firebase libraries:

implementation "com.google.firebase:firebase-core:16.0.0"

Solution 4

Update project gradle play service dependency with latest release :

classpath 'com.google.gms:google-services:4.0.1'

and

Update project firebase products usage as per firebase latest release note

Solution 5

This worked for me.this shoud be on top if you use firebase libraries:

implementation "com.google.firebase:firebase-core:15.0.0"

Share:
56,236
Giorgio Provenzale
Author by

Giorgio Provenzale

Updated on July 09, 2022

Comments

  • Giorgio Provenzale
    Giorgio Provenzale almost 2 years

    I have a problem on my Android project, I can't build, this is the error I have:

    Failed to notify dependency resolution listener. The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.2,15.0.2], [15.0.4,15.0.4]], but resolves to 15.0.4. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

    I tried many different solution I found but the problem persists. I have the right dependencies and repositories on gradle file on project root:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'
    }
    

    and

    repositories {
        jcenter()
        mavenLocal()
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
    }
    

    On my app gradle I have the following dependencies:

    implementation "com.google.android.gms:play-services-maps:15.0.1"
    implementation "com.google.android.gms:play-services-places:15.0.1"
    implementation "com.google.android.gms:play-services-gcm:15.0.1"
    implementation "com.google.android.gms:play-services-location:15.0.1"
    implementation "com.google.android.gms:play-services-analytics:15.0.2"
    implementation "com.google.android.gms:play-services-auth:15.0.1"
    implementation "com.google.android.gms:play-services-tagmanager:15.0.2"
    implementation "com.google.firebase:firebase-core:16.0.0"
    

    Some suggestions?

    The solution was update the following dependencies:

    implementation "com.google.android.gms:play-services-analytics:16.0.0"
    implementation "com.google.android.gms:play-services-tagmanager:16.0.0"
    
  • Giorgio Provenzale
    Giorgio Provenzale about 6 years
    check my question, they are already updated to the last version
  • Ravi Kishan Nag
    Ravi Kishan Nag about 6 years
    @Giorgio I faced same issue, after placing maven { url "maven.google.com" } on top (Before jcenter() ) that worked for me....i am talking about sequences
  • Gautam Dev
    Gautam Dev about 6 years
    Please try to invalidate,clean and rebuild project.
  • Giorgio Provenzale
    Giorgio Provenzale about 6 years
    yes, thanks a lot!! In my case I need to update also com.google.android.gms:play-services-tagmanager to 16.0.0
  • Giorgio Provenzale
    Giorgio Provenzale about 6 years
    I tried it and it didn't solve the issue, I updated the question with the solution
  • Giorgio Provenzale
    Giorgio Provenzale about 6 years
    I tried it and it didn't solve the issue, I updated the question with the solution
  • Jim Factor
    Jim Factor about 6 years
    From their Android SDK Install docs it looks like they want it in the app/build.gradle documentation.onesignal.com/docs/android-sdk-setup
  • egorikem
    egorikem about 6 years
    @JimFactor Yeah, but somehow this was the issue and I've spent like half a day trying to figure it up; ended up this this solution and everything seems just fine since then
  • Michał Tajchert
    Michał Tajchert about 6 years
    Watch out as I had to downgrade from 16.0.1 to 16.0.0 to make it work.
  • elliptic1
    elliptic1 almost 6 years
    Check the newest versions for each lib here: dl.google.com/dl/android/maven2/index.html
  • JeremyF
    JeremyF almost 6 years
    Thank you! Is this a safe fix, though?
  • Dima Kozhevin
    Dima Kozhevin almost 6 years
    @JeremyF this solution has been successfully used since June 2018 in my real projects that have thousands of users but "...THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY..." :)
  • squirly
    squirly almost 6 years
    For those using this with the android gradle plugin >= 3.1 and google-services=4.1.0 this may be your issue~
  • Arash Hatami
    Arash Hatami over 5 years
    Amazing !! Thank you
  • deadfish
    deadfish about 5 years
    ..in project's build.gradle !
  • Sopan Kurkute
    Sopan Kurkute over 4 years
    I am facing similar issues. I am wondering where and in which file one need to add these lines.