(1) Install CDT, this will make Eclipse convenient to edit C++ sources
here.
(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
Installation
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:
- import hello-jni into eclipse
- right-click the project, chose “properties”
- select “Builder” in the left list
- click “New…” button on the right side
- in the list box, select “Program” as the config type; click “OK” button to enter the next step
- set name as “NDK Builder”
- set the Location as “/bin/bash”. If you’re on windows with cygwin, then use “c:\cygwin\bin\bash.exe” instead.
- set “Working Directory” to “/bin”. On cygwin set to “c:\cygwin\bin”
- 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:
- check “Refresh resources upon completion”
- check “Specific resources”
- click “Specify resources” button, set to your “lib” folder of your project
- check “Recursively include sub-folder”
Here’s the finished screen
- check “Allocate Console”
- check “Launch in background”
- check “Run the builder After a Clean”
- check “Run the builder During manual builds”
- check “Run the builder During auto builds”
- check “Specify working set of relevant resources”
- click “Specify Resources” button, set to the JNI folder of your project, and includes all files
The result looks like