gpt4 book ai didi

java - Ant 调试和 Ant 发布失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:59:53 26 4
gpt4 key购买 nike

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

BUILD FAILED

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 (Lollipop)。感谢您的帮助。

最佳答案

将android SDK更新到最新的构建工具后,我遇到了同样的错误。

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

这可以通过将工具添加到 build.xml 并指向正确的路径来解决。对我来说这是 build-tools\22.0.1

请对比并更新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}" />

谢谢亚历克斯的提示!

关于java - Ant 调试和 Ant 发布失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30801483/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com