Address: http://blog.csdn.net/ariesjzj/article/details/7388874
The basic step is to first compile the C function into a. So library, and then use the Java masterProgramLoad the database and call the functions through JNI.
The first step is to download the ndk. Some of the examples are suitable for getting started. install or decompress them as described in the official document.
Step 2: Compile the dynamic link library. Take hello-JNI, one of the samples that comes with ndk as an example. First, enter this directory and run ndk-build (under the ndk directory) to generate the following directories:
Libs: Stripped. So, which is usually used to link to the library of the final app.
OBJ: no stripped. So, debugging information such as this signed Table, can be used in debug.
Assets, Gen, res, and other things
Note that the application. mk in JNI can indicate whether the generated target is for the arm or X86 platform. To compile. So into an x86 Platform, create application. mk under JNI:
App_abi: = x86
Step 3: Compile the APK of the entire app. Initially, the project directory generally contains two folders, one JNI, containing the c file, and the other SRC, containing the Java file. After so is compiled in the previous step, use eclipse to import the project (file-> New-> Project-> Android Project). Then, an option is to load the project from an existing project, it automatically parses android. fill in the MK file.
Finally, the runtime in eclipse will automatically generate the final executable file with the so of the specified Platform compiled just now, and automatically package it into the APK. If n devices are connected, remember which one to use before running.