Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0)

82,955

Solution 1

Make sure you have google() repository in project-level build.gradle before any others:

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
    }
}

Solution 2

Add this line in build.gradle

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

or

googleServices.disableVersionCheck = true

Solution 3

I encountered the same issue after updating. Try to verify if you installed the latest Build Tool and Google Repository versions.

enter image description here

Also, verify the Project's build.gradle that you're using google() and the build tool version. After checking the build.gradle, try to re-sync, clean, and re-build your project.

If needed, try to update to the latest version of your project's dependencies.

buildscript {

    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
    }
    // ...
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Solution 4

in my case i just update Andorid SDK Platform-Tools previous was 28.0.0 when i updated it to 28.0.1 problem fix!

enter image description here

Solution 5

All of sudden with out any changes in my project I was getting below error.

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0).

In project level build.gradle

buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
        maven {
            url 'https://dl.bintray.com/android/android-tools'
        }
    }
dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
    }

and

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://google.bintray.com/exoplayer/' }
    }
}

with above settings I had no luck.

Below is what worked for me I found that the problem is with onesignal

I added exclude clause to dependency:

implementation ('com.onesignal:OneSignal:3.10.5') {
    exclude group: 'com.google.android.gms'
}

then added the missing dependencies manually. After adding exclude clause I got Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 12.1.0). If you find any other missing dependencies just do as I did below.

In the module level build.gradle I replaced

implementation 'com.google.firebase:firebase-messaging:17.4.0' with
implementation 'com.google.firebase:firebase-messaging:10.2.1'

and finally Build completed successfully. I wasted almost 5 hours on this. Hope this helps some one.

Share:
82,955
Riddhi
Author by

Riddhi

I am an enthusiastic programmer! who just love coding and learning new things!!

Updated on February 09, 2022

Comments

  • Riddhi
    Riddhi over 2 years

    I am using firebase for my android app and suddenly I am getting an error when I tried to run the app. Saturday it was working perfectly. I don't know how this error occurred and how to solve this. Please help me.

    dependencies in my build.gradle

    dependencies {
        compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
            transitive = true;
        }
        compile 'com.android.volley:volley:1.0.0'
        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.android.support:cardview-v7:23.4.0'
        compile 'com.facebook.android:facebook-android-sdk:4.1.0'
        compile 'com.google.code.gson:gson:2.8.4'
        compile 'com.android.support:multidex:1.0.3'
        compile 'com.microsoft.azure:azure-mobile-android:3.1.0'
        compile 'com.mixpanel.android:mixpanel-android:4.8.0'
        compile 'com.firebase:firebase-client-android:2.4.0'
    
        compile 'com.google.firebase:firebase-core:16.0.0'
        compile 'com.google.firebase:firebase-auth:16.0.1'
        compile 'com.android.support:support-v4:23.4.0'
        compile 'com.android.support:design:23.4.0'
        compile 'com.j256.ormlite:ormlite-android:4.48'
        compile 'com.j256.ormlite:ormlite-core:4.48'
        compile 'com.android.support:recyclerview-v7:23.4.0'
        compile 'com.github.tibolte:elasticdownload:1.0.+'
        compile 'me.dm7.barcodescanner:zxing:1.8.4'
        compile 'com.google.android.gms:play-services-vision:15.0.2'
        compile 'com.android.support.constraint:constraint-layout:1.1.1'
        compile 'com.github.amlcurran.showcaseview:library:5.4.3'
        compile 'com.wang.avi:library:2.1.3'
        testCompile 'junit:junit:4.12'
        androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.0'
        androidTestCompile 'com.android.support.test:rules:1.0.2'
    }
    apply plugin: 'com.google.gms.google-services'
    

    In my project level build.gradle:

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

    The Error I am getting:

    Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0).