Build Failed Error[Solved]

Tried using ionic build android and got the following error

E:\SERVER\Mobile\AATTApp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,E:\SERVER\Mobile\AAT
TApp\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: E:\SERVER\Mobile\AATTApp\platforms\android\cordova\build.bat: Command fai
led with exit code 8
at ChildProcess.whenDone (C:\Users\ME\AppData\Roaming\npm\node_modules\cordo
va\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)

Anyone with an idea as to what that means? I’m using the latest versions of Ant, Android, Ionic and Cordova as well as Java

I ended up with this issue this morning as well. I think that’s only part of the stack trace though.

Here’s the full…

BUILD FAILED
/source/tools/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:932: The following error occurred while executing this line:
/source/tools/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:950: java.lang.ArrayIndexOutOfBoundsException: 1
	at com.android.ant.DependencyGraph.parseDependencyFile(DependencyGraph.java:180)
	at com.android.ant.DependencyGraph.<init>(DependencyGraph.java:54)
	at com.android.ant.SingleDependencyTask.initDependencies(SingleDependencyTask.java:87)
	at com.android.ant.AaptExecTask.execute(AaptExecTask.java:509)
	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:483)
	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:124)
	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:483)
	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:483)
	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:483)
	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)

Total time: 1 second
Error code 1 for command: ant with args: debug,-f,/source/MobileSoccer/soccer-io/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /source/MobileSoccer/soccer-io/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:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:755:16)
    at Process.ChildProcess._handle.onexit (child_process.js:822:5)

Hmm…

I don’t think the problem is actually with q.js. I think an asycronous process is failing and q is just throwing the error. Do you have any other spew above the q error, @icecappacino?

Well I solved it by deleting and adding back the platform…

Yeah, I was thinking about that, but I am about to start adding proper native code to my project.

I’ve had to “delete platform and reinstall” a few times in various phonegap projects. It makes me nervous about cordova as a whole.

I ended up doing the same and porting a bit of native code.

I don’t like this though and it would be nice to know what actually happened.

How did you solve this. I made a copy of my project and am getting this error no matter what I try. With an Ionic starter project, I get no error.

I have removed all plugins and rebuilt after removing every.single. time.

BUILD FAILED

/Users/cpk2/android-sdk/tools/ant/build.xml:698: null returned: 1

Total time: 7 seconds

/Users/cpk2/Sites/amazingMobileTest/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: ant with args```

same here, does anyone have information how to avoid this error?

I could swear that last week the same code was compiling just fine.
Tried adding removing android, didn’t help.

Thanks for any indications of the problem.

1 Like

I went as far as completely removing node, and re installing without sudo. Im running out of ideas here.

I solved my problem. Again it was my own fault :confused:

Did you read in the console what is written before the BUILD FAILED?
Even if there are no errors I found an important indication for my problem.
Apparently I used a ’ in the app title (in France here). After removing it everything went fine.
So maybe there is also some strange error in your AndroidManifest coming from your ionic config? (app name or something else?)

1 Like

Thanks @tobika. Solved the issue it was simply this one line in config.xml :

xmlns:gap="http://phonegap.com/ns/1.0" in

<widget id="com.ionicframework.myAppName385182" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">

Can’t believe it was so simple. Took me quite a while to find this. Hope it helps someone.

cool, glad it worked out alright for you

1 Like