Why is BUILD FAILED?

5k views Asked by At

I am trying to run simplest Qt application on android device. There are AVD and real phone with android. For both of them I get error:

BUILD FAILED
/home/user1/dev/android-sdk-linux/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/user1/dev/android-sdk-linux/tools/ant/build.xml:655: Execute failed: java.io.IOException: Cannot run program "/home/user1/workspace/build-Test11123-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/${aidl}": error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
        at java.lang.Runtime.exec(Runtime.java:617)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        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.AidlExecTask$AidlProcessor.process(AidlExecTask.java:102)
        at com.android.ant.MultiFilesTask.processFiles(MultiFilesTask.java:131)
        at com.android.ant.AidlExecTask.execute(AidlExecTask.java:203)
        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.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.<init>(UNIXProcess.java:186)
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
        ... 48 more

Total time: 0 seconds
Building the android package failed!
  -- For more information, run this command with --verbose.
16:30:43: The process "/opt/Qt/5.4/android_armv7/bin/androiddeployqt" exited with code 14.
Error while building/deploying project Test11123 (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.4.2))
When executing step "Build Android APK"

Building Qt Android App fails did not help me.

Qt 5.4.2
QtCreator 3.4.1
Galaxy S4 Active
AVD: API Level 22 armeabi-v7a
java-7-openjdk-amd64

2

There are 2 answers

1
jakule On BEST ANSWER

I had the same problem. Adding these lines to build.xml file solved it:

<property name="aidl" location="${sdk.dir}/build-tools/22.0.1/aidl${exe}" />
<property name="aapt" location="${sdk.dir}/build-tools/22.0.1/aapt${exe}" />
<property name="dx" location="${sdk.dir}/build-tools/22.0.1/dx${exe}" />
<property name="zipalign" location="${sdk.dir}/build-tools/22.0.1/zipalign${exe}" />
0
rgezikov On

It seems some Android SDK version (22, for instance) are missing several tools in the ant build.xml. So lines described above in mastertoster's answer should be added to <sdk root>/tools/ant/build.xml file.