【问题标题】:ERROR: Could not find com.android.tools.build:gradle:3.2.1错误:找不到 com.android.tools.build:gradle:3.2.1
【发布时间】:2019-12-15 05:23:56
【问题描述】:

当我想打开或运行项目时,出现以下错误:

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

这是我的 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // 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
}

默认情况下,它包含 google repo,但错误存在。 我在 ubuntu 19.1 上运行,并按照说明进行操作,但不幸的是我无法解决这个问题。 感谢社区。​​p>

【问题讨论】:

    标签: java android kotlin flutter dart


    【解决方案1】:

    我记得遇到过这样的问题,然后意外地发现我有网络问题!

    以下步骤可能对您有所帮助: - 检查您的系统代理设置。 - 然后,文件 -> 无效的 Cashes/Restart。

    【讨论】:

    • 文件在哪里?!
    【解决方案2】:

    尝试类路径'com.android.tools.build:gradle:3.5.3'

    也是一个不相关的补充,Kotlin 是 -> ext.kotlin_version = '1.3.61'

    【讨论】:

    • 我试了一下,结果还是一样!!
    【解决方案3】:

    清除 gradle 缓存

    rm -rf $HOME/.gradle/caches
    

    并重新同步以下载所有依赖项

    转到设置/Gradle/Android Studio。然后选中“启用嵌入式 Maven 存储库”。一切顺利。

    【讨论】:

      猜你喜欢
      • 2017-08-21
      • 2020-03-27
      • 2020-12-24
      • 2018-02-03
      • 2020-09-24
      • 2020-11-23
      • 2015-09-06
      • 1970-01-01
      • 2019-05-19
      相关资源
      最近更新 更多