如何在Android Studio中手动安装gradle-5.5.1-all.zip?

时间:2019-07-18 21:51:34

标签: java android android-studio gradle

我想在Android Studio 3.4.2上安装gradle 5.5.1(从本地),为此下载gradle-5.5.1-all.zip和“ gradle-wrapper.properties”文件进行以下更改:

distributionUrl=file:///E:/Downloads/gradle-5.5.1-all.zip

并在“ build.gradle”上:

buildscript {
repositories {
    google()
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:5.5.1'
 }
}

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

但是当要创建项目时,出现此错误:

  ERROR: Could not find com.android.tools.build:gradle:5.5.1.
Searched in the following locations:

https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.pom   -https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.jar   -https://jcenter.bintray.com/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.pom   -https://jcenter.bintray.com/com/android/tools/build/gradle/5.5.1/gradle-5.5.1.jar

Required by:
   project :
Open File

但是这些URL上没有文件,怎么了?

1 个答案:

答案 0 :(得分:2)

只需替换以下错误行:

classpath 'com.android.tools.build:gradle:5.5.1'

带有实际存在的构建工具版本:

classpath 'com.android.tools.build:gradle:3.4.2'