问题描述
我想生成APK使用ant命令行。我可以用蚂蚁干净,但对于蚂蚁调试和蚂蚁释放命令我收到以下错误。
I am trying to generate apk on command line using ant. I am able to use ant clean but for ant debug and ant release command I am getting following error.
BUILD失败。
C:\机器人\ SDK \工具\蚂蚁\ build.xml文件:649:执行此行出现以下错误: C:\机器人\ SDK \工具\蚂蚁\ build.xml文件:694:执行失败:产生java.io.IOException:不能运行程序C:\工作区\ SampleApp \ $ {} AAPT:CreateProcess的错误= 2,钍 Ë系统找不到指定的文件 在java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) 在java.lang.Runtime.exec(Runtime.java:617) 在org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(JAV a13CommandLauncher.java:58)...
C:\Android\sdk\tools\ant\build.xml:649: The following error occurred while executing this line: C:\Android\sdk\tools\ant\build.xml:694: Execute failed: java.io.IOException: Cannot run program "C:\Workspace\SampleApp\${aapt}": CreateProcess error=2, Th e system cannot find the file specified 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(Jav a13CommandLauncher.java:58)...
在一行的build.xml:694 proguardFile =$ {out.absolute.dir} /proguard.txt>
行是present。我使用的Eclipse朱诺和构建目标是22(棒棒堂)。任何帮助是AP preciated。
On line build.xml:694 proguardFile="${out.absolute.dir}/proguard.txt">
line is present. I am using Eclipse Juno and build target is 22 (Lollipop).Any help is appreciated.
推荐答案
我已经更新了Android SDK到最新版本的工具后,同样的错误。
I had the same error after updating the android SDK to the latest build tools.
该工具\蚂蚁\ build.xml脚本不包含这些工具的任何引用。
The tools\ant\build.xml script does not contain any references for the tools.
这是可以解决的,通过添加工具到build.xml并指向正确的路径。对我来说,这是集结工具\ 22.0.1
This can be solved, by adding the tools to the build.xml and point to the correct path. For me this was build-tools\22.0.1
请比较和更新build.xml中的工具栏目
Please compare and update the tool section in build.xml
<!-- tools location -->
<property name="android.tools.dir" location="${sdk.dir}/tools" />
<property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
<property name="android.buildtools.dir" location="${sdk.dir}/build-tools/22.0.1" />
<condition property="exe" value=".exe" else=""><os family="windows" /></condition>
<condition property="bat" value=".bat" else=""><os family="windows" /></condition>
<property name="adb" location="${android.platform.tools.dir}/adb${exe}" />
<property name="lint" location="${android.tools.dir}/lint${bat}" />
<property name="zipalign" location="${android.buildtools.dir}/zipalign${exe}" />
<property name="aidl" location="${android.platform.tools.dir}/aidl${exe}" />
<property name="aapt" location="${android.buildtools.dir}/aapt${exe}" />
<property name="dx" location="${android.buildtools.dir}/dx${bat}" />
<property name="renderscript" location="${android.buildtools.dir}/llvm-rs-cc${exe}"/>
<property name="lint" location="${android.tools.dir}/lint${bat}" />
感谢您亚历克斯的小费!
Thank you Alex for the tip!
这篇关于蚂蚁调试和蚂蚁释放失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!