When we develop a Android project includes the JNI technique, we should use the Android NDK tool for building these source code. But, the NDK is a command line tool that not convenient to use when we develop in the IDE.

In this article, I shows an example to explain the steps to build JNI source code in Eclipse.

The key is you have to create a new Builder used to execute the NDK tool for building JNI source code. So, at first, you have to create a new Builder in the Eclipse.

In my example, I try to add a new NDK Builder for OpenCV project in the Eclipse.

Step 1: Enter to the Project’s property window, and then click the “New” button to create a new Builder.

Step 2: Because we want to insert our own building tool, so we select the “Program” item.

Step 3: We should give a Builder name, NDK path, Project path.

Step 4: Set the refresh resources. In this step, you should select the “libs” folder for refreshing when building completion.

Step 5: Change to the “Build Options” label. Specify the resource to be compiled. You have to select the “jni” folder that contains the JNI source code.

Step 6: When you complete these configurations, the project will start the building procedure. Then, you can found out the libraries in the “libs” folder.