【问题标题】:Android Studio Could not find com.android.tools.build:gradle:4.0.1. ErrorAndroid Studio 找不到 com.android.tools.build:gradle:4.0.1。错误
【发布时间】:2020-11-23 18:09:02
【问题描述】:
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

那是错误日志。 我在许多网站上搜索,我得到的只是在build.gradle 文件中添加google(),而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,但有人知道在哪里复制和粘贴吗?

【问题讨论】:

  • 确保您已启用离线工作或您未连接到活动互联网,以便 AS 可以下载 lib 并将其保存在 AS 的缓存目录中
  • @faiiziiawan 我尝试了离线模式,但我得到了错误No cached version of com.android.tools.build:gradle:4.0.1 available for offline mode. 所以......还有什么?
  • 那么你需要用活跃的互联网构建项目
  • @faiiziiawan 我也试过了。没用。
  • 你的安卓工作室版本是多少?应该是 v4 签入 help->about 部分

标签: android android-studio gradle


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-13
    • 2020-11-19
    • 2017-08-21
    • 2020-03-27
    • 1970-01-01
    • 2020-11-02
    • 1970-01-01
    相关资源
    最近更新 更多