'Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0)
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).
Solution 1:[1]
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 2:[2]
I encountered the same issue after updating. Try to verify if you installed the latest Build Tool and Google Repository versions.
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 3:[3]
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!
Solution 4:[4]
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Solution 5:[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.
Solution 6:[6]
In my case everything was working fine, but suddenly I encountered this problem in the next "run action"!
Anyway, the problem is solved by updating com.google.gms:google-services in the project build.gradle file to its latest version as the below :
buildscript {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Also, make sure that:
- You are not in offline mode.
- And if you are using Http Proxy, you can connect to the google repository.
Note (in the above sample):
Android Studio : 3.4.2
compileSdkVersion 28
targetSdkVersion 28
Solution 7:[7]
Build -> Clean Project
was enough in my special case (with gms:v15.0.1 and firebase:v16.0.1).
Solution 8:[8]
I solved this issue with this build.gradle [Proyect]
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
google()
jcenter()
maven {
url 'https://dl.bintray.com/android/android-tools'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
}
Solution 9:[9]
OPTION 1:
Follow the below instruction to resolve it.
Project-level build.gradle
use
maven { url "https://www.jitpack.io" }
instead of
maven { url "https://jitpack.io" }
OPTION 2:
Follow the below steps to resolve it.
Step1:
Project-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://jitpack.io" } // For Ucrop
maven { url "https://maven.google.com" } // Google's Maven repository - FCM
maven {
url 'https://dl.bintray.com/azeesoft/maven'
}
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Step2:
App-level build.gradle
I have update One Signal version.
use
implementation 'com.onesignal:OneSignal:3.11.1'
instead of
implementation 'com.onesignal:OneSignal:3.10.9'
Solution 10:[10]
Changing
implementation('com.onesignal:OneSignal:3.15.1')
with
implementation('com.onesignal:OneSignal:3.15.1') {
exclude group: 'com.android.support', module: 'customtabs'
exclude group: 'com.google.android.gms'
}
solved my problem.
Solution 11:[11]
Possible reasons would be
- Internet not connected/work Offline not enabled from AndroidStudio Preference
- Cached versions of dependancy not exists
- Proxy enabled
- Google Play Service Temporarily Unavailable
Solution :
Along with the above answers don't forget to add mavenLocal() inside project level build.gradle
allprojects {
repositories {
......
......
mavenLocal()
}
}
This helps to access cached dependencies when Service Temporarily Unavailable
Solution 12:[12]
This is what worked for me. In project-level Gradle file use the following order:
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://jitpack.io"
}
jcenter()
}
}
Solution 13:[13]
i deleted every firebase plugin like:
from pubspec.yaml
and run pub get and flutter run
add packages again
run pub get and flutter run again
worked for me.
if not fixed, try packages one by one
Solution 14:[14]
go to build.gradle in android directory , insert
maven { url 'https://maven.google.com' }
in top position of repositories of allprojects same this :
allprojects {
repositories {
maven { url 'https://maven.google.com' } //<<--Insert this above google()
google()
Solution 15:[15]
Just run build with Internet Connected (it worked for me).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow


