Ant调试和ant发布失败 [英] Ant debug and ant release failed

查看:40
本文介绍了Ant调试和ant发布失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 ant 在命令行上生成 apk.我可以使用 ant clean 但对于 ant debug 和 ant release 命令,我收到以下错误.

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.

构建失败

C:\Android\sdk\tools\ant\build.xml:649: 执行此行时出现以下错误:C:\Android\sdk\tools\ant\build.xml:694: 执行失败: java.io.IOException: 无法运行程序 "C:\Workspace\SampleApp\${aapt}": CreateProcess error=2, Th系统找不到指定的文件在 java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)在 java.lang.Runtime.exec(Runtime.java:617)在 org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.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"> 行存在.我正在使用 Eclipse Juno,构建目标是 22(棒棒糖).任何帮助表示赞赏.

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.

tools\ant\build.xml 脚本不包含对工具的任何引用.

The tools\ant\build.xml script does not contain any references for the tools.

这可以解决,方法是将工具添加到 build.xml 并指向正确的路径.对我来说这是 build-tools\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}" />

谢谢亚历克斯的提示!

这篇关于Ant调试和ant发布失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆