Build failed for android: error code 1 and 8


#1

Hi guys,

I encounter some problems building or emulating for android. Ionic serve works with no problems. But when I try to emulate or build, I get an error. I tried to start a new project:

ionic start test
cd test
ionic platform add android

Every commands worked. However when I tried to emulate or build, I get this error (I was running : ionic emulate android)

    add to body class: platform-android
Running command: c:\wamp\www\ionic\test\platforms\android\cordova\run.bat --emulator
Buildfile: c:\wamp\www\ionic\test\platforms\android\build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 23.0.2
 [checkenv] Installed at C:\wamp\www\android\adt\sdk

-setup:
     [echo] Project Name: test
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 20.0.0
     [echo] Resolving Build Target for test...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: c:\wamp\www\ionic\test\platforms\android\ant-build\rsObj
    [mkdir] Created dir: c:\wamp\www\ionic\test\platforms\android\ant-build\rsLibs
     [echo] ----------
     [echo] Resolving Dependencies for test...
[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 23.0.2
 [checkenv] Installed at C:\wamp\www\android\adt\sdk

-setup:
     [echo] Project Name: test
  [gettype] Project Type: Android Library

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 20.0.0
     [echo] Resolving Build Target for test...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\rsObj
    [mkdir] Created dir: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\rsLibs
     [echo] ----------
     [echo] Resolving Dependencies for test...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found new input file
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
     [echo] Creating library output jar file...

-post-compile:

-obfuscate:

-dex:
     [echo] Library project: do not convert bytecode...

-crunch:
   [crunch] Crunching PNG Files in source dir: C:\wamp\www\ionic\test\platforms\android\CordovaLib\res
   [crunch] To destination dir: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [echo] Library project: do not package resources...

-package:
     [echo] Library project: do not package apk...

-post-package:

-do-debug:
     [echo] Library project: do not create apk...
[propertyfile] Updating property file: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\build.prop

-post-build:

debug:

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:
     [echo] Set jars path to: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\classes.jar

-compile:
    [javac] Compiling 3 source files to c:\wamp\www\ionic\test\platforms\android\ant-build\classes
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] 3 warnings

-post-compile:

-obfuscate:

-dex:
      [dex] input: c:\wamp\www\ionic\test\platforms\android\ant-build\classes
      [dex] input: C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\classes.jar
      [dex] Pre-Dexing C:\wamp\www\ionic\test\platforms\android\CordovaLib\ant-build\classes.jar -> classes-8f8c74b3c5b004579b82e3643a29d85a.jar
       [dx] La syntaxe du nom de fichier, de r�pertoire ou de volume est incorrecte.
       [dx] 

(for some reason, the end of the error didnt get print in the file, here it is)

I’m using windows 8 with the following setup.

My paths:
ANDROID_SWT: C:\wamp\www\android\adt\sdk\tools\lib\x86_64
JAVA_ANDROID_EXE: C:\Java\jdk1.8.0_20\bin\java.exe
JAVA_HOME: C:\Java\jdk1.8.0_20
PATH:
%JAVA_HOME%\bin;
C:\Users\Christophe\Downloads\apache-ant-1.9.4-bin\apache-ant-1.9.4\bin;
C:\wamp\www\android\adt\sdk\tools;
C:\wamp\www\android\adt\sdk\platform-tools;

Versions
Cordova: 3.6.3-0.2.13
Ionic: 1.2.8-beta1
Java: 1.8.0_20
Ant: 1.9.4
Android Device Manager:

However, running ant -v, I get this error:

Apache Ant(TM) version 1.9.4 compiled on April 29 2014
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed

Ant seems to be the problem, but reinstalling it did not change anything.

Thanks.


#2

Didn’t fix the problem, but if someone end up on this thread by google

Using vagrant ionic works for me
https://github.com/driftyco/ionic-box