I am trying to create a build script using gradle to build a android project and using plugins from eclipse and android but it doesnt seem to work and failes with the following error when I run 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'.
Here is my build script:
//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 thrown below:
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.
I downloaded full gradle version from this link: http://www.gradle.org/downloads
Version 0.8 did not support the
applysyntax for plugins yet. Starting with version 0.9 theapplymethod was introduced. A similar issue is described in this post.Version 0.8 is pretty old. I’d highly recommend upgrading to the latest version of Gradle. That should definitely fix your problem.