【发布时间】:2013-12-28 05:53:45
【问题描述】:
我正在尝试使用 gradle 创建一个简单的 android 项目。我在一台装有 Debian GNU/Linux 7 'wheezy' 的电脑上工作。
我按照Gradle Plugin User Guide - Android Tools Project Site 中的建议进行操作,但出现错误:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/alex/Proyectos/MyLogin/build.gradle' line: 11
* What went wrong:
A problem occurred evaluating root project 'MyLogin'.
> Could not create plugin of type 'AppPlugin'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.817 secs
我遵循了规范:
- Gradle 1.9
- 插件 0.7
- SDK 17+(实际上是 19)
我也重新开始了一个项目,我展示的结果是由命令gradle tasks发出的,如文档所示。
我也试过gradle 1.10,结果还是一样。
即使this question 也没什么用,因为它通过“升级”到 gradle 1.6 来解决(我知道插件 0.7 至少需要 gradle 1.9)。
在 android-studio 和 IntelliJ Idea 中出现相同错误后,我尝试了此操作。
编辑:我还尝试了两个 IDE 中的新项目,但遇到了同样的问题。但最让我惊讶的是,这两个 IDE 都以包装形式使用 gradle 1.8。我试图让他们两个都使用我的本地 gradle 安装,但仍然是同样的问题。
我做错了什么?它是一个错误吗?我怎样才能避免这个问题?
请帮帮我。
编辑:这是我的build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 14
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
sourceCompatibility = 1.6
version = '0.1'
dependencies {
compile 'com.android.support:support-v4:18.0.0'
//compile project(':core')
}
【问题讨论】:
-
你能展示一下你的“build.gradle”是什么样子的吗?
-
很抱歉遗漏了如此重要的数据。这是
build.gradle。 -
我试过这个“build.gradle”——这个错误出现在 gradle 1.10 下并通过降级到 1.9 解决。