1, eclipse 新建android项目,添加jni目录,配置ndk
2,jni目录下新建第三方库的引用源文件目录,包含各个平台的so包以及对应的头文件
3,配置Android.mk
第三方库引用的配置文件如:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := 引用库别名
LOCAL_SRC_FILES :=$(TARGET_ARCH_ABI)/引用库文件名称.so
include $(PREBUILT_SHARED_LIBRARY)
主引用Android.mk文件内容:
TOP_LOCAL_PATH :=$(call my-dir)
include $(call all-subdir-makefiles)
LOCAL_PATH := $(TOP_LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE:= 生成库文件名称
LOCAL_SHARED_LIBRARIES := \
引用库别名
LOCAL_SRC_FILES :=\
XXXX.cpp\
XXXX.cpp
LOCAL_LDLIBS += -llog
include $(BUILD_SHARED_LIBRARY)
so库编译命令:
ndk-build APP_ABI="armeabi armeabi-v7a x86 mips"
时间: 2024-10-29 08:35:11