- 编写应用层接口调用方式,so库名字
在app的build.gradle 中
ndk { moduleName "rui" ldLibs"log","z","m" abiFilters "armeabi" }
项目的gradle.properties
android.useDeprecatedNdk=true
4.创建jni目录 命令行自动生成头文件
javah -d ../jni com.example.rui.ndkthree.MainActivity
进入到jni所在目录 ,MainActivity 为so所在目录
- 编写so名字.c 具体的实现
android。mk 文件有问题!
{LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := rui SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) SRC_FILES := $(SRC_FILES:$(LOCAL_PATH)/%=%) LOCAL_SRC_FILES := rui.c LOCAL_LDLIBS := -llog -landroid LOCAL_LDLIBS := -llog include $(BUILD_SHARED_LIBRARY)}