Android Google Services无法下载4.2.0

时间:2018-12-10 14:27:53

标签: android android-studio gradle android-gradle

我正在尝试将Google Services版本从3.1.0更新到4.2.0。

build.gradle{
 buildscript{
  repositories {
     google()
     jcenter()
  }
  dependencies {
     classpath 'com.google.gms:google-services:4.2.0'
  }
 }
}

allprojects {
 repositories {
   jcenter()
   mavenCentral()
   google()
   flatDir {
     dirs 'libs'
   }
  }
}

我知道

Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.google.gms:google-services:4.2.0.

Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.google.gms:google-services:4.2.0.
Searched in the following locations:
    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://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

Android Studio版本3.2.1

渐变包装4.6

1 个答案:

答案 0 :(得分:-1)

我也曾经遇到过这个问题,有时序列很重要,也要删除分号。尝试以下...

build.gradle{
 buildscript{
  repositories {
     google()
     jcenter()
     mavenCentral()
  }
  dependencies {
     classpath 'com.google.gms:google-services:4.2.0'
  }
 }
}

allprojects {
 repositories {
   google()
   jcenter()
   mavenCentral()

  }
}

已更新: 遇到此错误时,订购解决了我的问题。但是,您需要添加以下存储库,因为中央存储库中不存在4.2.0版本

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