错误:找不到com.google.gms:google-services:4.2.0

时间:2018-12-10 13:20:48

标签: android firebase android-studio android-gradle jcenter

今天,我试图将com.google.gms:google-services从4.1.0更新到4.2.0,因为它是最新版本,并且是recommended的firebase版本。但是我得到这个错误:

Could not find com.google.gms:google-services:4.2.0.
Searched in the following locations:
    https://jcenter.bintray.com/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
    https://jcenter.bintray.com/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
    https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
    https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
    https://maven.fabric.io/public/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
    https://maven.fabric.io/public/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
Required by:
    project :

这是我的项目的构建gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'

        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.27.0'
    }
}

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

更新:

正如道格·史蒂文森(Doug Stevenson)所说,该依赖关系现已启动并正在运行,因此只需在存储库中使用google()。

如果您对其他Google存储库(firebase,exoplayer)有任何疑问,可以跟踪问题进度here

4 个答案:

答案 0 :(得分:34)

2018年12月10日(星期一)太平洋标准时间下午1:30

发现jCenter上缺少Google Play服务插件,Firebase Performance监视插件,exoplayer和其他可能的依赖项。目前尚不清楚原因,但已知有些团队将其构建工件移至Google Maven存储库中。

截至目前,Google Play服务插件已迁移,现在应该可以通过构建脚本中的google()使用。

答案 1 :(得分:26)

由于google-services:4.2.0在中央存储库中不可用,因此需要从Android工具存储库中下载。要将其添加到您的项目中,请添加

MSALPublicClientApplication

此以构建脚本存储库。有关更多信息,请参见https://mvnrepository.com/artifact/com.google.gms/google-services/4.2.0

maven { url 'https://dl.bintray.com/android/android-tools' }

答案 2 :(得分:8)

尝试一下,为我工作:

<f:form method="POST" action="list" id="eventsearch" name="eventsearch" class="eventsearchform">

答案 3 :(得分:4)

google-services:4.2.0现在又回到了Google Maven存储库,只需使用默认配置同步gradle:

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