今天我试图将com.google.gms:google-services从4.1.0更新到4.2.0,因为它是最新版本并由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)有任何问题,可以在此处跟踪问题进度.
2018年12月10日星期一,太平洋标准时间下午1:30
在jCenter上发现了Google Play服务插件,Firebase性能监控插件,exoplayer以及可能的其他依赖项.目前尚不清楚为什么,但已知一些团队正在将他们的构建工件移动到Google maven repo.
截至目前,Google Play服务插件已经迁移,现在应该可以通过构建脚本中的google()获取.
由于google-services:4.2.0在Central Repository中不可用,因此需要从Android Tools Repository下载.要将此添加到您的项目添加
maven { url 'https://dl.bintray.com/android/android-tools' }
这到buildcript存储库.有关更多信息,请参阅https://mvnrepository.com/artifact/com.google.gms/google-services/4.2.0
buildscript { repositories { jcenter() google() maven { url 'https://maven.fabric.io/public' } // Add this to your project maven { url 'https://dl.bintray.com/android/android-tools' } } 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() } }
试试这个,为我工作:
buildscript { repositories { google() //jcenter() jcenter {url 'https://dl.bintray.com/android/android-tools'} jcenter {url 'https://firebase.bintray.com/gradle'} mavenCentral () } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.google.gms:google-services:4.2.0' classpath 'com.google.firebase:firebase-plugins:1.1.5' } } allprojects { repositories { google() //jcenter() jcenter {url 'https://dl.bintray.com/android/android-tools'} jcenter {url 'https://firebase.bintray.com/gradle'} mavenCentral () } } task clean(type: Delete) { delete rootProject.buildDir }
google-services:4.2.0现在又回到了Google Maven存储库,只需将gradle与默认配置同步即可:
allprojects { repositories { google() jcenter() } }