Android Studio找不到com.android.tools.build:gradle:4.0.1。错误

时间:2020-08-03 16:37:51

标签: android android-studio gradle

Could not find com.android.tools.build:gradle:4.0.1.
Searched in the following locations:
  - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
  - https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
Required by:
    project :
Open File

这是错误日志。 我在许多网站上进行了搜索,得到的只是在google()文件中添加build.gradle,而android studio已经做到了。

我也尝试过mavenCentral(),但该错误仍然存​​在。 我安装了AS 3.1,然后将其升级到了最新的稳定版本4.0.1。

build.gradle文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

已编辑: 我可以手动下载https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom,但是有人知道在哪里复制和粘贴它吗?

1 个答案:

答案 0 :(得分:0)

几天来我遇到了同样的问题,昨天我解决了。 在这里检查我的答案: Could not find com.android.tools.build:gradle:4.0.1 OR 4.0.0 OR any versions