5

I have build a Java appliction which is using ant.jar (ant 1.8.2) classes for building android application from it's build.xml file with release as target. My Android project has been built by using android create project command, using sdk 2.2. When I run my application for building the Android application I get the following message -

build.xml:46: taskdef class com.android.ant.SetupTask cannot be found

I have verified the sdk.dir path and the sdk-location path and both are correct.

How it can be solved?

Thanks, Eyal.

eyal
  • 2,379
  • 7
  • 40
  • 54

4 Answers4

17

You need to update the project:

android update project --path .
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Sorry there was an error in the option; it should have been '--path'. Can you retry it please? – trojanfoe Jan 05 '11 at 15:07
  • When I had this problem, this answer is the one that fixed it for me. Thank you, @trojanfoe. – steveha Mar 16 '12 at 04:18
  • Tried it. Error >> "build.xml: Failed to find version-tag string. File must be updated. In order to not erase potential customizations, the file will not be automatically regenerated. If no changes have been made to the file, delete it manually and run the command again. If you have made customizations to the build process, the file must be manually updated." – emeraldhieu May 06 '12 at 15:08
  • Also make sure that if you're referencing other projects through various properties that you update those too. – dpjanes Jul 01 '13 at 12:18
1

Have you verified that the com.android.ant.SetupTask class is indeed in the sdk.dir and sdk-location path that you define?

If on Linux, the following command, run at the root of those directories, can tell you if the class is found by looking in all class and JAR files:

   grep -ri "com.android.ant.SetupTask" *
jamesmortensen
  • 33,636
  • 11
  • 99
  • 120
0

I had this problem and realised the build.xml file was old. Try creating a new project and make sure you've got the most up-to-date build.xml file (with the new imports, etc). Good luck.

0

In a Windows Vista box, I solved that by updating the following line in the "build.properties" file located at zxing root directory:

android-home=[YOUR PATH HERE]

...after that one, I had another error about "proguard.jar", which I also had to point to the correct location:

proguard-jar=C:\android_sdk\tools\proguard\lib\proguard.jar

After that I managed to compile further.

Valdez V.
  • 252
  • 5
  • 18
  • There are some notes in the "build.xml" file that point you to build the core.jar module using: "ant build-no-debug" ... long story they say LOL – Valdez V. Nov 16 '11 at 00:30