can't build for android ([apply] error: no command specified ... dx)

228 views
Skip to first unread message

Shiri

unread,
Oct 24, 2009, 9:46:45 PM10/24/09
to zxing
Hi,

I'm trying to build zxing for android. After following the
instructions on the "getting started" (http://code.google.com/p/zxing/
wiki/GettingStarted) wiki page, I am getting this error:

[echo] Converting compiled files and external libraries into bin/
classes.d
x...
[apply] error: no command specified
[apply] usage:
[apply] dx --dex [--debug] [--verbose] [--positions=<style>] [--
no-locals
.....

BUILD FAILED
c:\users\shiri\dev\projects\zxing-read-only\android\build.xml:217:
apply returne
d: 1


Someone else reported this problem on the "getting started" wiki.
sro...@gmail.com suggested checking the android-home variable. I have
set the android-home variable correctly. It's pointing to the 1.6 sdk,
which the instructions tell you to download, so I'm stumped.

Thank you for your help!
-SA

Sean Owen

unread,
Oct 25, 2009, 8:11:07 AM10/25/09
to zxing
I feel like I've seen this before but forget the issue. Run with ant -
v to see what dx command it is generating? That would probably point
out the problem.

There's an old (harmless) issue whereby not setting ${external-libs-
folder} results in a folder with that name being created and passed to
dx, which should do nothing. But maybe somehow it's an issue now.

Shiri

unread,
Oct 29, 2009, 3:04:29 PM10/29/09
to zxing
I ran "ant -v" but I'm not sure what to make of the output:

dex:
[echo] Converting compiled files and external libraries into bin/
classes.dex...
Property "external-libs-folder" has not been set
[apply] Current OS is Windows Vista
[apply] Executing 'c:\users\shiri\dev\lib\android-sdk-
windows-1.6_r1\platforms\android-1.6\tools\dx.bat' with arguments:
[apply] '-JXmx256M'
[apply] '--dex'
[apply] '--output=c:\users\shiri\dev\projects\zxing-read-only
\android\bin/classes.dex'
[apply] 'c:\users\shiri\dev\projects\zxing-read-only\android\bin
\classes'
[apply]
[apply] The ' characters around the executable and arguments are
[apply] not part of the command.
[apply] error: no command specified
[apply] usage:
[apply] dx --dex [--debug] [--verbose] [--positions=<style>] [--
no-locals]
[apply] [--no-optimize] [--statistics] [--[no-]optimize-
list=<file>] [--no-strict]
[apply] [--keep-classes] [--output=<file>] [--dump-to=<file>] [--
dump-width=<n>]
[apply] [--dump-method=<name>[*]] [--verbose-dump] [--no-files]
[--core-library]
[apply] [<file>.class | <file>.{zip,jar,apk} | <directory>] ...
[apply] Convert a set of classfiles into a dex file,
optionally embedded in a
[apply] jar/zip. Output name must end with one
of: .dex .jar .zip .apk. Positions
[apply] options: none, important, lines.
[apply] dx --annotool --annotation=<class> [--element=<element
types>]
[apply] [--print=<print types>]
[apply] dx --dump [--debug] [--strict] [--bytes] [--basic-blocks
| --rop-blocks]
[apply] [--width=<n>] [<file>.class | <file>.txt] ...
[apply] Dump classfiles in a human-oriented format.
[apply] dx --junit [-wait] <TestClass>
[apply] Run the indicated unit test.
[apply] dx -J<option> ... <arguments, in one of the above forms>
[apply] Pass VM-specific options to the virtual machine that
runs dx.
[apply] dx --version
[apply] Print the version of this tool (1.2).
[apply] dx --help
[apply] Print this message.

It looks like dx.bat is called on with several arguments, but they
aren't used when dx is called? I'm not sure.

Thanks for your help!

Sean Owen

unread,
Oct 29, 2009, 3:24:59 PM10/29/09
to zxing
My next best guess is:

You're on Windows, and I am not sure the build script is entirely
Windows-proofed, and the only nagging issue is path separator (/ vs.
\) . This line looks problematic:

--output=c:\users\shiri\dev\projects\zxing-read-only \android\bin/
classes.dex

You could try replacing / with \ in the build.xml file(s)?

Shiri

unread,
Oct 29, 2009, 6:42:29 PM10/29/09
to zxing
I got it to build!

I changed the slashes to backslashes in the build.xml as you suggested
but still got the same error. I then did a quick google search on the
error and found this site:

http://code.google.com/p/android/issues/detail?id=4217

Apparently there is a problem with the android sdk's dx.bat. The link
above has a modified dx.bat file which seems to do the trick. Now it
builds successfully! Now I'll try running it on the phone...

shiri

On Oct 29, 12:24 pm, Sean Owen <sro...@gmail.com> wrote:
> My next best guess is:
>
> You're on Windows, and I am not sure the build script is entirely
> Windows-proofed, and the only nagging issue is path separator (/ vs.
> \) . This line looks problematic:
>
> --output=c:\users\shiri\dev\projects\zxing-read-only \android\bin/
> classes.dex
>
> You could try replacing / with \ in the build.xml file(s)?
>
Reply all
Reply to author
Forward
0 new messages