title: Cordova: ant error code 1 when building android hello world app
body: <p>Clean install of Cordova on an Ubuntu 12.04, then installed Android ADT bundle and added the platform-tools and tools to the path.
  Then created the hello app from toturial at apache Cordova. but it refuses to build.</p>
  
  <p>See the error I'm getting:</p>
  
  <pre><code>aus@devhost:/opt/android_app/hello$ cordova build
  Running command: /opt/android_app/hello/platforms/android/cordova/build
  Buildfile: /opt/android_app/hello/platforms/android/build.xml
  
  -set-mode-check:
  
  -set-debug-files:
  
  -check-env:
   [checkenv] Android SDK Tools Revision 22.6.2
   [checkenv] Installed at /opt/android_app/hello/adt-bundle-linux-x86_64-20140321/sdk
  
  -setup:
       [echo] Project Name: HelloWorld
    [gettype] Project Type: Application
  
  -set-debug-mode:
  
  -debug-obfuscation-check:
  
  -pre-build:
  
  -build-setup:
  [getbuildtools] Using latest Build Tools: 19.0.3
       [echo] Resolving Build Target for HelloWorld...
  [gettarget] Project Target:   Android 4.4.2
  [gettarget] API level:        19
       [echo] ----------
       [echo] Creating output directories if needed...
       [echo] ----------
       [echo] Resolving Dependencies for HelloWorld...
  [dependency] Library dependencies:
  [dependency]
  [dependency] ------------------
  [dependency] Ordered libraries:
  [dependency]
  [dependency] ------------------
       [echo] ----------
       [echo] Building Libraries with 'debug'...
  
  nodeps:
  
  -set-mode-check:
  
  -set-debug-files:
  
  -check-env:
   [checkenv] Android SDK Tools Revision 22.6.2
   [checkenv] Installed at /opt/android_app/hello/adt-bundle-linux-x86_64-20140321/sdk
  
  -setup:
       [echo] Project Name: CordovaLib
    [gettype] Project Type: Android Library
  
  -set-debug-mode:
  
  -debug-obfuscation-check:
  
  -pre-build:
  
  -build-setup:
  [getbuildtools] Using latest Build Tools: 19.0.3
       [echo] Resolving Build Target for CordovaLib...
  [gettarget] Project Target:   Android 4.4.2
  [gettarget] API level:        19
       [echo] ----------
       [echo] Creating output directories if needed...
      [mkdir] Created dir: /opt/android_app/hello/platforms/android/CordovaLib/ant-   build/rsObj
      [mkdir] Created dir: /opt/android_app/hello/platforms/android/CordovaLib/ant-build/rsLibs
       [echo] ----------
       [echo] Resolving Dependencies for CordovaLib...
  [dependency] Library dependencies:
  [dependency] No Libraries
  [dependency]
  [dependency] ------------------
  
  -code-gen:
  [mergemanifest] No changes in the AndroidManifest files.
       [echo] Handling aidl files...
       [aidl] No AIDL files to compile.
       [echo] ----------
       [echo] Handling RenderScript files...
       [echo] ----------
       [echo] Handling Resources...
       [aapt] Generating resource IDs...
  
  BUILD FAILED
  /opt/android_app/hello/adt-bundle-linux-x86_64-20140321/sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
  /opt/android_app/hello/adt-bundle-linux-x86_64-20140321/sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
  /opt/android_app/hello/adt-bundle-linux-x86_64-20140321/sdk/tools/ant/build.xml:698:     Execute failed: java.io.IOException: Cannot run program "/opt/android_app/hello/adt-bundle-linux-x86_64-20140321/sdk/build-tools/android-4.4.2/aapt" (in directory "/opt/android_app/hello/platforms/android/CordovaLib"): error=2, No such file or directory
   at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
   at java.lang.Runtime.exec(Runtime.java:617)
   at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:41)
   at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
   at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
   at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628)
   at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
   at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
   at com.android.ant.AaptExecTask.execute(AaptExecTask.java:699)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
   at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.Target.execute(Target.java:435)
   at org.apache.tools.ant.Target.performTasks(Target.java:456)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
   at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
   at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440)
   at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:303)
   at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
   at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   at org.apache.tools.ant.Target.execute(Target.java:435)
   at org.apache.tools.ant.Target.performTasks(Target.java:456)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
   at org.apache.tools.ant.Main.runBuild(Main.java:851)
   at org.apache.tools.ant.Main.startAnt(Main.java:235)
   at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
   at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
  Caused by: java.io.IOException: error=2, No such file or directory
   at java.lang.UNIXProcess.forkAndExec(Native Method)
   at java.lang.UNIXProcess.&lt;init&gt;(UNIXProcess.java:135)
   at java.lang.ProcessImpl.start(ProcessImpl.java:130)
   at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
   ... 68 more
  
  Total time: 1 second
  Error code 1 for command: ant with args: debug,-    f,/opt/android_app/hello/platforms/android/build.xml,-Dout.dir=ant-build,-    Dgen.absolute.dir=ant-gen
  Error: /opt/android_app/hello/platforms/android/cordova/build: Command failed with exit code 2
      at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
      at ChildProcess.EventEmitter.emit (events.js:110:17)
      at maybeClose (child_process.js:992:16)
      at Process.ChildProcess._handle.onexit (child_process.js:1064:5)
  </code></pre>
  
  <p>Any ideas what i'm missing? doesn't seems to be dependencies, I didn't get errors during the installation of npm, cordova, jdk-7, android sdk, ant, nodejs etc.</p>
  
  <p>Also, in the error message it refers to build.xml, that file exists with content. but when I try it with ant directly I get:</p>
  
  <pre><code>aus@devhost:/opt/android_app/hello$ ant /opt/android_app/hello/platforms/android/build.xml
  Buildfile: build.xml does not exist!
  Build failed
  </code></pre>
  
  <p>probably should use ant like that but I had to try.</p>
  
  <p>So the solution was to run those commands:
  sudo dpkg --add-architecture i386
  sudo apt-get -qqy update
  sudo apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386</p>
  
  <p>appearantly android sdk have some dependency on 32bit architechture.</p>