Riddhi Shah
Riddhi Shah

Reputation: 3122

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).

Upvotes: 44

Views: 125861

Answers (16)

Zaman Rajpoot
Zaman Rajpoot

Reputation: 523

i was facing this error failed to resolve com.google.firebase:firebase-ml-vision-image-label-model:20.1.0 solution just remove the

com.google.firebase:firebase-ml-vision-image-label-model:20.1.0

from the gradle.build (app)

Upvotes: 0

Fivos
Fivos

Reputation: 568

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()
    }
}

Upvotes: 2

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()

Upvotes: 1

Mohammad Shamsi
Mohammad Shamsi

Reputation: 571

i deleted every firebase plugin like:

  1. firebase_core
  2. cloud_firestore
  3. firebase_dynamic_links
  4. firebase_messaging
  5. firebase_auth

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

Upvotes: 0

Ahmet B.
Ahmet B.

Reputation: 1674

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.

Upvotes: 2

Gautam Surani
Gautam Surani

Reputation: 1185

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

Upvotes: 19

Suresh Maidaragi
Suresh Maidaragi

Reputation: 2308

Possible reasons would be

  1. Internet not connected/work Offline not enabled from AndroidStudio Preference
  2. Cached versions of dependancy not exists
  3. Proxy enabled
  4. 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

Upvotes: 1

VIISHRUT MAVANII
VIISHRUT MAVANII

Reputation: 12678

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' 

Upvotes: 2

Ghasem Sadeghi
Ghasem Sadeghi

Reputation: 1854

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

Upvotes: 3

WIT_NGU
WIT_NGU

Reputation: 136

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.

Upvotes: 4

M E S A B O
M E S A B O

Reputation: 953

    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

Upvotes: 4

teteArg
teteArg

Reputation: 4004

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'
    }
}

Upvotes: 2

Erfan
Erfan

Reputation: 3343

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

Upvotes: 5

Mir-Ismaili
Mir-Ismaili

Reputation: 16948

Build -> Clean Project

was enough in my special case (with gms:v15.0.1 and firebase:v16.0.1).

Upvotes: 2

jjz
jjz

Reputation: 2057

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
}

Upvotes: 10

mpontus
mpontus

Reputation: 2193

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

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

Upvotes: 35

Related Questions