Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant Build Failed

Tags:

android

ant

I am trying to build an Android Project using Apache Ant through Command Line but it is giving me Build Failed with the following error statements:
Java.io.IOException: Cannot run Program. "..\android_sdk\platform-tools\aapt.exe"

D:\MediaSync\build.xml:429: Execute failed: java.io.IOException: Cannot run program "..\android_sdk\platform-tools\aapt.exe"

I am new to this thing so i am not getting any idea how to get over this error. Searched alot about it but still scratching my head..
Anybody any idea about it then please tell me.

EDIT: Here are parts of my Buil.xml file

<!-- General SDK location -->
<property name="sdk-folder" value="D:/sdk" />  

<!-- Preset tools location -->
<property name="android-platform-tools" value="${sdk-folder}/platform-tools"/> 

 <!-- Tools -->
<condition property="aapt" value="${android-platform-tools}/aapt.exe" else="${android-platform-tools}/aapt" >
    <os family="windows"/>
</condition>  


<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="init, localization, replace-template-values">
    <echo>Generating R.java / Manifest.java from the resources...</echo>
    <exec executable="${aapt}" failonerror="true">
        <arg value="package" />
        <arg value="-m" />
        <arg value="-J" />
        <arg value="${outdir-r}" />
        <arg value="-M" />
        <arg value="${outdir.manifest}/AndroidManifest.xml" />
        <arg value="-S" />
        <arg value="${resource-dir}" />
        <arg value="-I" />
        <arg value="${android-jar}" />
    </exec>

</target>
like image 316
Noman Avatar asked Jan 24 '26 01:01

Noman


1 Answers

Make sure aapt.exe is installed at the correct path relative to your build.xml file (../android_sdk/platform-tools). That path is likely relative to your project, but not the build.xml.

like image 157
user1676075 Avatar answered Jan 25 '26 15:01

user1676075



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!