ant jar error: Execute failed: java.io.IOException: Cannot run program...${aapt}": error=2, No such file or directory

14,245

Solution 1

Have you updated the Android SDK tools to 24.3.2? This seems to have caused the issue. Add following 4 lines to android-sdk-path/tools/ant/build.xml starting line 484 and hopefully it should solve.

<property name="aidl" location="${android.build.tools.dir}/aidl${exe}" />
<property name="aapt" location="${android.build.tools.dir}/aapt${exe}" />
<property name="dx" location="${android.build.tools.dir}/dx${bat}" />
<property name="zipalign" location="${android.build.tools.dir}/zipalign${exe}" />

Solution 2

This is fixed in the latest tools update ( https://code.google.com/p/android/issues/detail?id=176488 )

Share:
14,245
luxchar
Author by

luxchar

Updated on June 07, 2022

Comments

  • luxchar
    luxchar almost 2 years

    I'm trying to compile a simple Java library for Unity, and after running ant jar, I get the following message:

    /Applications/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
    /Applications/adt-bundle-mac-x86_64-20140702/sdk/tools/ant/build.xml:694: Execute failed: java.io.IOException: Cannot run program "/Users/****/UnityProjects/****/JavaTestPlugin/${aapt}": error=2, No such file or directory
    

    This is strange, because I've compiled this class before successfully, and I have everything I would think I need. Namely Android Studio, and related packages (Tools, Android 4/5, etc). I noticed that aapt is not located in my adt-bundle/sdk/platform-tools directory, but it is in one of the build-tools directories. Even including the latter in my path did not help.

    Anyway, I am running Mac OS 10.10.3, with the most up-to-date version of Android Studio. This class compiled before upgrading to Yosemite. I've seen suggestions on how to fix this issue, but all of those suggestions apply to Linux as opposed to Mac OS.