PowenKo, NDK, Tutorial 003, Install NDK on MAC with Eclipse

(1) Install CDT, this will make Eclipse convenient to edit C++ sources


(2) Anyedit plugin is recommended. Download from http://andrei.gmxhome.de/anyedit/ It’s not required, but very useful to edit various types of files


Please use Eclipse update manager to install this plugin.

Eclipse 3.3 – 3.4:

Go to “Help -> Software Updates -> Find and Install… -> Search for new features to install -> Next -> New Remote Site…”

Eclipse 3.5 – 3.7:

Go to “Help -> Install new Software… -> Work with:”

and use the http://andrei.gmxhome.de/eclipse/ as url.

(3) Create a new project based on NDK. We use hello-jni as the sample.

Do this steps:

  1. import hello-jni into eclipse
  2. right-click the project, chose “properties”
  3. select “Builder” in the left list
  4. click “New…” button on the right side
  5. in the list box, select “Program” as the config type; click “OK” button to enter the next step
  6. set name as “NDK Builder”
  7. set the Location as “/bin/bash”. If you’re on windows with cygwin, then use “c:\cygwin\bin\bash.exe” instead.
  8. set “Working Directory” to “/bin”. On cygwin set to “c:\cygwin\bin”
  9. set “Arguments” to:
    –login -c “cd $ANDROID_NDK_ROOT/samples/hello-jni && ndk-build”
    Make sure there’re two hyphens before login, and the double quotation marks after -c. ANDROID_NDK_ROOT is the full path of NDK. After this steps, the interface should be like this:
Then open the “refresh” tab

  1. check “Refresh resources upon completion”
  2. check “Specific resources”
  3. click “Specify resources” button, set to your “lib” folder of your project
  4. check “Recursively include sub-folder”
    Here’s the finished screen
Then open “Build Options” tab

  1. check “Allocate Console”
  2. check “Launch in background”
  3. check “Run the builder After a Clean”
  4. check “Run the builder During manual builds”
  5. check “Run the builder During auto builds”
  6. check “Specify working set of relevant resources”
  7. click “Specify Resources” button, set to the JNI folder of your project, and includes all files
    The result looks like
$ ndk-build

Leave a Reply