http://blog.bruary.net/2009/07/android-hello-ndk.html
http://davanum.wordpress.com/2007/12/09/android-invoke-jni-based-methods-bridging-cc-and-java/
http://www.koushikdutta.com/2009/01/jni-in-android-and-foreword-of-why-jni.html
1. Create a Class in your project
2. Build application, you should find a class file in bin dir, for example, "bin\com\test\netmonitor"
3. Generate header file using javah.First move yourself to bin dir, and then type:
javah com.test.netmonitor.NativeProc
4. Do function implementation base on header file.
./jni/
./jni/include
./jni/include/com_test_netmonitor_NativeProc.h
./jni/src
./jni/src/NativeProc.c
./jni/Android.mk
5. Build the library based on the name you specify in System.loadLibrary();
6. Install libs to your system(/system/lib/)
7. Install apk, check the function.
[Note] If javah fail, you can tailer NativeProc.java and compile it to .class using javac. Then put new .class into bin/com/test/netmonitor and javah again.
No comments:
Post a Comment