1. Configure the NDK
1.1 Downloads NDK
Android Studio 1.2 with android-ndk-r10e, different versions of studio need to be configured with different ndk, after the download is complete, unzip and drop it into a file directory
1.2 Specifying the NDK directory
1.3 Modifying the Build.gradle configuration
What needs to be modified is the <project>\app\build.gradle
2. Add Native Interface
2.1 Adding native
2.2 Execute build, make Project
Determine that the program has no errors and generate a. class file
2.3 Generate. h header files from Javah
2.3.1 Open cmd2.3.2 Enter <project>\app\src\main directory 2.3.3 input command javah-d jni-classpath F:\android-sdk-windows\platforms\ Android-16\android.jar, .... \.. \build\intermediates\classes\debug Com.oki.led.jni.AppJNI 2.3.4 generates the result. h file
3. Edit. C Files
3.1 Add a Com_oki_led_jni_appjni.c file
3.2 Execute Build-> Make Project determine success
3.3 Execute Build-> Rebuild Project can generate so packages
4. Quoting so packages
Appjni Appjni = new Appjni ();
Appjni. Method name (parameter)
JNI in Android Studio--1--Configuration method