Cannot build android for base project

I followed the basic steps for getting a simple project started with cocos2d-js

I am running OSX.

I have the pre-requisites installed, ndk, sdk, ant… and have run the setup.py and used the cli to generate the base project.

I have installed the android platform with the android sdk manager.
I can compile and run for the web and mac targets correctly.

The step I am stuck on is this one:

cocos compile -p android

I get the following error running this command:

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files…
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files…
[echo] ----------
[echo] Handling Resources…
[aapt] Generating resource IDs…

BUILD FAILED
/Users/jerry/Documents/android-sdk-macosx/tools/ant/build.xml:597: The following error occurred while executing this line:
/Users/jerry/Documents/android-sdk-macosx/tools/ant/build.xml:649: The following error occurred while executing this line:
/Users/jerry/Documents/android-sdk-macosx/tools/ant/build.xml:694: Execute failed: java.io.IOException: Cannot run program “/Users/jerry/Documents/gamename/frameworks/js-bindings/cocos2d-x/cocos/platform/android/java/${aapt}” (in directory “/Users/jerry/Documents/gamename/frameworks/js-bindings/cocos2d-x/cocos/platform/android/java”): error=2, No such file or directory

1 Like

I have a similar problem using the command line run option with the following error output:

/Users/stefan/Documents/android/sdk/tools/ant/build.xml:597: The following error occurred while executing this line:
/Users/stefan/Documents/android/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
/Users/stefan/Documents/android/sdk/tools/ant/build.xml:694: Execute failed: java.io.IOException: Cannot run program "/Users/stefan/Workspace/PrimaryParticle/proj.android/google-play-services_lib/${aapt}" (in directory "/Users/stefan/Workspace/PrimaryParticle/proj.android/google-play-services_lib"): error=2, No such file or directory

Mac OSX: 10.10.3
My cocos2d-x version: 3.6
Android SDK: 4.4.2
NDK: android-ndk-r10d
Apache Ant™ version 1.9.4

Some informations has been omitted from the latest android SDK.
You can solve it by adding some lines to the SDK/tools/ant/build.xml

2 Likes

Thank you! This worked for me.

This issue can solve by update your ‘Android SDK Tools’ to the latest version(24.3.3).