Error "taskdef class com.android.ant.SetupTask cannot be found"

Hello! On windows 7, with cmd, I’am trying to do: “gradle eclipse” in “D:\Programmes\workspaceEclipse\project”

But I got this error

"FAILURE: Build failed with an exception.

  • Where: Build file ‘D:\Programmes\workspaceEclipse\project\build.gradle’ line: 12

  • What went wrong: A problem occurred evaluating root project ‘project’. Cause: taskdef class com.android.ant.SetupTask cannot be found

using the classloader AntClassLoader[]"

I tried to put in the “local.properties” file of the project this line : "sdk.dir=‘D:\Programmes\eclipse\android-sdk’ but it does not change anythings.

Do you have any idea? Thanks a lot !!

hi marion, can you share your build script with us?

Hi ! :slight_smile:

Of course!

this is the file build.gradle in project

" // Known issues : // gradle idea removes the java sdk configuration to 1.6, need to re-config it after each gradle idea use.

buildscript {

repositories {

mavenRepo(urls: ‘http://jvoegele.com/maven2/’)

}

dependencies {

classpath ‘com.jvoegele.gradle.plugins:android-plugin:1.0.0’

} } apply plugin: ‘android’ apply plugin: ‘idea’ apply plugin: ‘eclipse’

ideaProject {

//

javaVersion = ‘Android 2.2 Google APIs’

withXml { provider ->

def node = provider.asNode()

def vcsConfig = node.component.find { it.’@name’ == ‘VcsDirectoryMappings’ }

vcsConfig.mapping[0].’@vcs’ = ‘Git’

} }

sourceSets {

main {

java {

srcDir ‘src’

}

} }

repositories {

mavenCentral()

mavenRepo name: ‘guice’, urls: ‘http://guice-maven.googlecode.com/svn/trunk’ }

versions = [

commons_lang3: ‘3.0.1’,

roboguice: ‘1.1.2’,

joda_time: ‘2.0’,

gson:

‘1.7.1’, ]

libraries = [

commons_lang3: ‘org.apache.commons:commons-lang3:’ + versions.commons_lang3,

roboguice: ‘org.roboguice:roboguice:’ + versions.roboguice,

joda_time: ‘joda-time:joda-time:’ + versions.joda_time,

gson:

‘com.google.code.gson:gson:’ + versions.gson, ]

dependencies {

compile libraries.commons_lang3

compile libraries.roboguice

compile libraries.joda_time

compile libraries.gson } "

I have just download “gradle-1.0-milestone-5” on the website and try a “gradle eclipse” in cmd. I suppose this file “build.gradle” has been created by this :slight_smile:

I am really noob with gradle, my teacher told me to install it but we can’t found from where come the bug.

just out of curiosity, what (kind of) teacher? I would be interested to know which school/university recommends gradle.

A french school: Supinfo.

We are “Java laboratory” of the school and he is the Lab “Manager”. We are working on some android projects for fun. (it is a kind of private University)

(That is why some sentences are not so good :roll: )

Nobody knows from where my problem come? =/ thanks!

Could it be that your ‘ANDROID_HOME’ environment variable is not correctly set?

https://github.com/jvoegele/gradle-android-plugin/wiki

Euuh.

I created this environnement variable: ANDROID_HOME with value D:\Programmes\eclipse\android-sdk but it still does not work.

Was it your suggestion?

Thank :slight_smile:

What’s in the following directiory on your system?

‘D:\Programmes\eclipse\android-sdk\tools\lib’

Do you ask me what files are in this folder?

If yes:

folders: emulator pc-bios x86 x86_64

files: android.el androidprefs.jar anttasks.jar archquery.jar AVD Manager build.template chimpchat.jar common.jar commons-codec-1.4.jar commons-compress-1.0.jar ddmlib.jar ddms.jar devices draw9patch.jar emma.jar emma_ant.jar emma_device.jar find_java groovy-all-1.7.0.jar guavalib.jar hardware-properties hierarchyviewer2.jar hierarchyviewerlib.jar httpclient-4.1.1.jar httpcore-4.1.jar httpmime-4.1.1.jar jcommon-1.0.12.jar jcommon-1.0.12.jar jfreechart-1.0.9.jar jfreechart-1.0.9-swt.jar jsilver.jar jython.jar layoutopt.jar libEGL_translator.dll libGLES_CM_translator.dll libGLES_V2_translator.dll libOpenglRender.dll mkidentity.jar monkeyrunner.jar org.eclipse.core.commands_3.4.0.I20080509-2000.jar org.eclipse.equinox.common_3.4.0.v20080421-2006.jar org.eclipse.jface_3.4.2.M20090107-0800.jar osgi.jar plugin.prop post_tools_install proguard.cfg SDK Manager sdklib.jar sdkmanager.jar sdkstats.jar sdkuilib.jar swing-worker-1.1.jar swtmenubar.jar traceview.jar uix.jar

A long list which make me feel stupid cause I am not sure of what you want :roll:

Thank you for your time

I just wanted to make sure that the SDK configuration was correct, which it seems to be. I can see the ‘anttasks.jar’ library in there which should have the ant tasks.

I’ve asked the plugins author to take a look at this thread. Hopefully he gets a chance to soon.

The author of the plugin has set up their own support channel. You should be able to get help there.

http://groups.google.com/group/gradle-android-plugin-users

If you find a resolution to this issue, please consider posting the answer back here in case anyone else has the same problem.

Thank you :slight_smile: I’ll post on it!