1 Establishment of the project
Run Eclipse and create a new Android project named Hello-jni (or something else you like, such as Fxxk-jni).
Project code from your ndk/samples/hello-jni copy one copy, remember to copy jni that directory, the final directory structure.
The Libs directory will be created automatically, and now it's okay to have wood.
If you run this project now, you will see the following error on the Android console:
Java.lang.UnsatisfiedLinkError:Library Hello-jni not found
Because you haven't made that libhello-jni.so out yet.
2. Configure project Properties
Open Hello-jni Project Properties, select Builder, select program, click OK
Configure as follows, name any one, location and working directory to be consistent with your Cygwin directory, arguments to your project directory.
My arguments is:--login-c "Cd/cygdrive/e/workspace/hello-jni && $ANDROID _ndk_root/ndk-build"
The picture above should be visible, then check the other configuration as follows
Note When you tick specify working set of relevant resources, specify the resource to select the JNI directory for your project.
When the above steps are correctly configured, the C-related code in the JNI directory should be automatically compiled and the corresponding. So library files are automatically created after the configuration is saved to the Libs directory of the project.
The compile-time console output resembles the following:
Run the project again and the results are correct.
After the C code changes, save will automatically trigger the compilation, saving time and effort.
Create a federated compilation environment for the NDK for Eclipse.