Can't build android project (Windows XP)

244 views
Skip to first unread message

alex_p

unread,
Dec 22, 2010, 9:31:13 AM12/22/10
to zxing
hi! i hope you guys can help me.
i'm trying to build the android package but i'm always getting the
same error:
"taskdef class com.android.ant.setuptask cannot be found"
everything worked fine with "core".
what i've tried so far:

using google
adding the path of android sdk and sdk/tools to PATH variable
adding sdk path in eclipse
adding "sdk-location= <path_to_sdk>" to build.properties
running "android update project -p <path_to_sdk>" to create
local.properties

nothing helped :(
maybe i'm doing something wrong?
os: windows xp.
i've heard about other people having the same problem, but couldn't
find any working solution.

Sean Owen

unread,
Dec 22, 2010, 9:33:58 AM12/22/10
to zx...@googlegroups.com
Your SDK isn't set up properly if this is the error you're seeing. Ant can't find Android custom tasks.

alex_p

unread,
Dec 22, 2010, 9:38:52 AM12/22/10
to zxing
thank you for your quick reply!
what exactly isn't set up? the installation of the sdk or some
properties?
i've already created some small applications and able to use android
commands such as "adb" or "android".

Sean Owen

unread,
Dec 22, 2010, 9:44:50 AM12/22/10
to zx...@googlegroups.com
You need to install, perhaps update, the Android SDK itself. It installs in your Ant setup some custom tasks. This is specific to Android, not this project.

alex_p

unread,
Dec 22, 2010, 10:40:06 AM12/22/10
to zxing
sadly, it didn't work. i just updated android sdk, but nothing
happened.
i then reinstalled ant and then android sdk again. still getting the
same error :(

alex_p

unread,
Dec 22, 2010, 11:08:45 AM12/22/10
to zxing
another strage thing is that after installing "android sdk r08" adb
got removed from tools folder. now it is in platform-tools folder. i
copied all the files back to tools, but still no luck.
any ideas?

alex_p

unread,
Dec 23, 2010, 4:52:56 AM12/23/10
to zxing
i've installed ant and android sdk on a fresh windows 7 computer. same
problem: core is building but android is not.
as far as i understand, building generates a .jar file. is it possible
that someone just send me his/her generated file? or maybe there is a
way to edit the build.xml and manualy insert the path to the sdk?

Lachezar Dobrev

unread,
Dec 23, 2010, 5:34:15 AM12/23/10
to zx...@googlegroups.com
Pointers:

Make sure you have _NO_SPACES_ in the directories of all development
tools: JDK, Ant, Android SDK. This is *MANDATORY*.

Update the project to the latest version from SVN to get the latest
changes needed for the latest Android SDK.

Add Ant to the PATH. Android SDK does not need to be in the PATH.

Go into <ZXING>/core and execute:
ant

Go into <ZXING>/android and execute (one line):
ant -Dandroid-home=C:/Path/To/Android/SDK -Dno-optimize

Notice the forward slashes. Notice the no-optimize to avoid Proguard
requirement.

2010/12/23 alex_p <alex.ph...@googlemail.com>:

alex_p

unread,
Dec 23, 2010, 7:09:11 AM12/23/10
to zxing
thank you for your reply!
my error mentioned above isn't showing up anymore. i see something is
working now but it throws some warnings about different translations
and then errors:

[exec] C:\Programme\zxing-1.6\android\res\values\strings.xml:96:
error: Multiple substitutions specified in on-positional format; did
you mean to add the formatted="false" attribute?

[exec] C:\Programme\zxing-1.6\android\res\values\strings.xml:96:
error: Unexpected end tag string

[exec] C:\Programme\zxing-1.6\android\res\values-cs\strings.xml:96:
error: Multiple substitutions specified in non-positional format; did
you mean to add the formatted="false" attribute?

[exec] C:\Programme\zxing-1.6\android\res\values-cs\strings.xml:96:
error: Unexpected end tag string

** <more errors that look similar> **
** and then: **

BUILD FAILED
C:\Programme\zxing-1.6\android\build.xml:144: exec returned: 1

your line "<ZXING>/android and execute (one line): ant -Dandroid-
home=C:/Path/To/Android/SDK -Dno-optimize" helped me here, although if
i use "-Dno-optimize" it says that no-optimize is missing value, so i
removed it.

Lachezar Dobrev

unread,
Dec 23, 2010, 10:48:32 AM12/23/10
to zx...@googlegroups.com
Whopsie...
My apologies.

The line should read:

ant -Dandroid-home=C:/Path/To/Android/SDK -Dno-optimize=

Notice the trailing equals sign (=).

On the other issue: the errors you are seeing are related to a
change in the latest Android SDK. Those have been fixed recently by
Sean, so update the source from the SVN repository.

2010/12/23 alex_p <alex.ph...@googlemail.com>:

alex_p

unread,
Dec 23, 2010, 2:02:17 PM12/23/10
to zxing
the last message i got:

BUILD SUCCESSFUL

i've added a "1" at the end of "-Dno-optimize=" and used the latest
sources from svn.

thank you guys for helping me!
Reply all
Reply to author
Forward
0 new messages