找不到与com.google.android.gms匹配的任何版本:play-services-base:[15.0.1,16.0.0)

Rid*_*dhi 19 android firebase google-play-services

我正在为我的Android应用程序使用firebase,当我试图运行应用程序时突然发现错误.星期六,它工作得很好.我不知道这个错误是怎么发生的以及如何解决这个问题.请帮我.

我的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'
Run Code Online (Sandbox Code Playgroud)

在我的项目级build.gradle中:

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:4.0.0'
    }
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

找不到与com.google.android.gms匹配的任何版本:play-services-base:[15.0.1,16.0.0).

mpo*_*tus 18

确保google()在其他任何项目之前在项目级build.gradle中拥有存储库:

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 在app-level build.gradle中查找"com.google.firebase:firebase-auth:16.0.0",然后尝试将其切换为"com.google.firebase:firebase-auth:16.0.1".https://firebase.google.com/docs/auth/android/start/ (2认同)

Gau*_*ani 7

在build.gradle中添加此行

apply plugin: 'com.google.gms.google-services'
// Work around for onesignal-gradle-plugin compatibility
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Run Code Online (Sandbox Code Playgroud)

  • 此解决方案有效...但是会有什么副作用? (4认同)

jza*_*elo 7

更新后,我遇到了同样的问题。尝试验证是否安装了最新版本的构建工具和Google Repository。

在此处输入图片说明

另外,请验证您正在使用的Projectbuild.gradlegoogle()以及构建工具的版本。选中后build.gradle,请尝试重新同步,清理并重新生成您的项目。

如果需要,请尝试更新到项目依赖项的最新版本。

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
}
Run Code Online (Sandbox Code Playgroud)


erf*_*fan 5

在我的情况下,Andorid SDK Platform-Tools当我将其更新为 28.0.1 问题修复时,我只是更新了以前的 28.0.0!

在此处输入图片说明