Android防止手动添加的本地库文件被NDK工具清理掉

时间:2021-06-17 04:15:30

比如要添加一个名为libocr的本地库,先将libocr.so文件拷贝到jni目录下,然后在Android.mk文件中添加以下语句即可。

例:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS := -llog

LOCAL_MODULE    := libyuv
LOCAL_SRC_FILES := ycrcbutils.c include $(BUILD_SHARED_LIBRARY) # Add prebuilt libocr
include $(CLEAR_VARS) LOCAL_MODULE := libocr
LOCAL_SRC_FILES := libocr.so include $(PREBUILT_SHARED_LIBRARY)