Ast*_*rum 2 android gradle android-studio android-gradle-plugin
这是我的build.gradle档案:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
这里是gradle-wrapper:
#Fri Jan 12 02:39:29 EST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
Run Code Online (Sandbox Code Playgroud)
完整的错误跟踪在这里:
Error:FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'CryptoGallery'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:4.1.
Searched in the following locations:
file:/home/xavi/android-studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.pom
file:/home/xavi/android-studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.jar
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Run Code Online (Sandbox Code Playgroud)
我查看了目录/home/xavi/android-studio/gradle/m2repository/com/android/tools/build/gradle/4.1/,看到我确实有一个gradle 4.1构建,但它.jar不像其他人那样包含简单.这是官方gradle网站的完整下载.它包含许多可执行文件,但没有标记gradle-4.1.jar为其他可执行文件.
编辑:更改classpath到正确的行后,android studio会提示我将我的gralde更新为4.4.1,然后我得到一个追溯.
不要将gradle与用于gradle 的androd插件混淆.
更改:
classpath 'com.android.tools.build:gradle:4.1'
Run Code Online (Sandbox Code Playgroud)
有:
classpath 'com.android.tools.build:gradle:3.0.1'
Run Code Online (Sandbox Code Playgroud)
更多信息在这里.
| 归档时间: |
|
| 查看次数: |
3589 次 |
| 最近记录: |