Put NDK_ROOT on MAC OS when use Eclipse to develop android games

Hi, I try to develop android games on MAC, but I’m a new to MAC OS.

I installed eclipse with CDT and ADT, I can compile android apps, but when I try to compile a cocos2d-x game, I receive the following error:

bash /Users/sociedademineiradeculturapucminasvirtual/fabio/programas/cocos2d-x-2.2.0/samples/Cpp/Shuriken/proj.android/build_native.sh 
NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties

I add the NDK_ROOT path inside Eclipse configuration in Preferences > Android> NDK, but it’s noit working.
How I can define NDK_ROOT inside the local.properties file? How I can define the NDK_ROOT in MAC OS?

Add to your .bash_profile file something like this:

export ANDROID_SDK="/Users/alexandr/Dev/android-sdk-macosx"
export ANDROID_NDK="/Users/alexandr/Dev/android-ndk-r8e"
export NDK_ROOT="$ANDROID_NDK"
export COCOS2DX_ROOT="/Users/alexandr/Dev/Cocos2d-x_workspace/cocos2d-x/cocos2dx"
export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK:$COCOS2DX_ROOT"

It works, thanks

1 Like