【发布时间】:2015-03-04 19:13:38
【问题描述】:
我想在我的 Android/Eclipse 项目中使用 gradle,因为我希望能够在发布版本旁边安装我的应用程序的开发版本(如下所示:What is a practical way to install stable and development app versions simultaneously?)
使用命令行这样做对我来说是可以的。
所以我将我的项目的 src 文件夹移动到 src/main/java 并创建了一个build.gradle 文件(如此处所述:http://www.nodeclipse.org/projects/gradle/android/Make-Android-Eclipse-project-ready-for-Android-Studio):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
androidTest.setRoot('tests')
}
}
但是当我运行gradle build 时,我得到了这个错误:
FAILURE: Build failed with an exception.
...
> Could not create plugin of type 'AppPlugin'.
我已经在 stackoverflow 上发现了这个错误。有人说是因为使用了错误的gradle版本。 (Gradle is issuing an error "Could not create plugin of type 'AppPlugin'")
我的问题:
- 据我了解,build.gradle (0.12.+) 中的这个版本号是 gradle 插件的版本,而不是 gradle 本身的版本。如何找出我正在使用的 gradle 插件版本?
- 这个插件是从哪里来的?它是 gradle 安装的一部分吗?还是 Eclipse 的一部分?还是 ADT?
- 我将 Gradle IDE 安装为 Eclipse 插件。它会干扰常规的 gradle 安装吗?
【问题讨论】: