Android NDK: From Elementary to Export Episode 6

来源:互联网 发布:mac如何播放图片 编辑:程序博客网 时间:2024/06/16 12:52

Here is a demo in Pro Android C++ with the NDK.
It introduced an app which could iterate the thread by native thread or POSIX thread.

First of all, you need to be noticed that there are two kinds of build system in Android Studio: CMakList.txt and Android.mk.

CMakeList.txt:
https://developer.android.com/studio/projects/add-native-code.html
Android.mk:
https://developer.android.com/ndk/guides/android_mk.html

Secondly, we need to add ndk-build block in build.gradle file
这里写图片描述

Then we use following command to generate header file for JNI.

javah -d jni -classpath java com.luxuan.threads.MainActivity

and finally, click the button, we can the see app running smoothly.
这里写图片描述

0 0
原创粉丝点击