【问题标题】:“could not find com.android.tools.build:gradle” error“找不到 com.android.tools.build:gradle”错误
【发布时间】:2017-08-21 07:17:30
【问题描述】:

我刚刚使用 NetBeans 8.2 创建了一个示例 HTML5/Cordova 项目,在构建过程中,我遇到了这个错误:

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find gradle.jar (com.android.tools.build:gradle:2.2.1).
  Searched in the following locations:

https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar

以前有没有遇到过这个问题? 我可以成功下载文件,所以没有连接问题。

【问题讨论】:

    标签: cordova gradle android-gradle-plugin


    【解决方案1】:

    对于 gradle 项目,您需要在名为 build buildscripts 的闭包中配置本地或远程依赖存储库。看起来您没有添加正确的远程存储库和依赖项,通常是 jcenter()。例如,在您的根 build.gradle 中,必须包含以下脚本。

    buildscript {
        repositories {
            google()
            maven {
                url "https://plugins.gradle.org/m2/"
            }
            jcenter() // the remote repositories. 
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1' // the gradle dependencies. 
        }
    }
    

    【讨论】:

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