Android studio 2,2中的错误

时间:2018-02-07 10:26:22

标签: android android-studio build.gradle

Error:Could not find com.android.tools.build:gradle:4.5.
Searched in the following locations:
    file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.5/gradle-4.5.pom
    file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.5/gradle-4.5.jar
    https://jcenter.bintray.com/com/android/tools/build/gradle/4.5/gradle-4.5.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/4.5/gradle-4.5.jar
    https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.5/gradle-4.5.pom
    https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.5/gradle-4.5.jar
Required by:
    project :

1 个答案:

答案 0 :(得分:3)

不要将 gradle 用于gradle的Android插件混淆

您正在寻找插件v.4.5 不存在

dependencies {
     //Change this line !!
     //classpath 'com.android.tools.build:gradle:4.5'
     classpath 'com.android.tools.build:gradle:3.0.1'
}

如果您想使用 gradle 4.5 ,则必须更改gradle-wrapper.properties文件:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip