我只是更新我的android studio预览3.0金丝雀3.之后我试图运行该项目,但显示以下错误。
Error:Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
file:/opt/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
file:/opt/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
Required by:
project :
答案 0 :(得分:6)
您需要做的主要事情是:
将项目级build.gradle
文件更改为:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
}
}
将gradle-wrapper.properties的distributionUrl
更改为当前最新的Gradle版本。
distributionUrl=https://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip
完成此步骤后,您的项目无法编译,并且您需要按照here的所有说明操作,了解如何将您的应用build.gradle
转换为新插件
答案 1 :(得分:0)
根据更新更改build.gradle (project_name)
的一行(classpath
): -
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}