为什么BUILD FAILED?

时间:2015-06-13 13:33:09

标签: android qt qt-creator

我正在尝试在Android设备上运行最简单的Qt应用程序。有Android的AVD和真正的手机。对于他们两个我得到错误:

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没有帮助我。

Qt 5.4.2
QtCreator 3.4.1
Galaxy S4 Active
AVD:API等级22 armeabi-v7a
的java -7-的openjdk-AMD64

2 个答案:

答案 0 :(得分:6)

我遇到了同样的问题。将这些行添加到 build.xml 文件解决了它:

<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}" />

答案 1 :(得分:0)

似乎有些Android SDK版本(例如22)缺少ant build.xml中的几个工具。因此,上面在mastertoster的答案中描述的行应添加到<sdk root>/tools/ant/build.xml文件中。