Setting for android development on Mac

Hi there, i’ve recently started developing using cocos2d-JS and have had some success. Setting up cocos for iOS development was no problem.

Now i’m interested in setting up cocos for android development. However, whenever I try and add the NDK, SDK or ANT root, the setup is unable to find the appropriate roots. I keep receiving error message in Terminal like,

->Error: " /Applications/Development/Android/sdk " is not a valid path of ANDROID_SDK_ROOT. Ignoring it.

Even though that is the path with the SDK root in it. Does anyone know what i’m doing wrong, and/or what I might be able to do to fix the problem?

Any help is appreciated!

You may try setup the path with Cocos Code IDE in Preferences->Cocos
Or you can run the Cocos framework setup.py to setup.

Example of path

Python location : /usr/bin
SDK location : /Android-Development/sdk
NDK location : /Android-Development/android-ndk-r10d
ANT location : /usr/local/ant
JDK location : /usr/bin

May be @SonarSystems tutorial can help you on this.
http://www.sonarlearning.co.uk/coursepage.php?topic=game&course=cocos2d-js-v3

1 Like

Thanks! I was able to get Terminal/Python to detect the SDK, NDK and ANT roots, but I now have another problem.

I can build a project no problem, but when I try and compile it using the following command:

cocos compile -p android

I get the follow error messages:

No Java runtime present, requesting install.
No Java runtime present, requesting install.
No Java runtime present, requesting install.
Error running command, return code: 1

With an error message popping up saying, “To view this web content you need to install the Java Runtime Environment”.

If I go to the Java website to update my Java, the website tells me my Java is up-to-date.

I’m not sure what to do! Again any help is appreciated!

Download the Java JDK from here and install it.
http://www.oracle.com/technetwork/java/javase/downloads/index.html