我正在尝试使用 gradle 创建一个构建脚本来构建一个 android 项目并使用来自 eclipse 和 android 的插件,但它似乎不起作用并且在我运行时失败并出现以下错误gradle eclipse
:
* What went wrong:
A problem occurred evaluating root project 'RssUnified'.
Cause: Could not find method apply() for arguments [{plugin=eclipse}] on root project 'RssUnified'.
这是我的构建脚本:
//apply eclipse plugin
apply plugin: 'eclipse'
//apply android plugin
apply plugin: 'android'
task hello << {
String value = 'wagwan'
println 'Hello world!' + value.toUpperCase()
}
//setup external dependancy plugins we will use to build a android application
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.1'
}
Gradle 异常抛出如下:
Exception in thread "main" java.lang.NoClassDefFoundError: org/gradle/BootstrapMain
Caused by: java.lang.ClassNotFoundException: org.gradle.BootstrapMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.gradle.BootstrapMain. Program will exit.
我从这个链接下载了完整的 gradle 版本:http: //www.gradle.org/downloads