如何在Android NDK中调用第三方库文件

2024-11-09 05:03:04
推荐回答(1个)
回答1:

1.在project/jni目录下创建prebuilt子目录(目录名可自定义).

2.将第三方.so放到prebuilt中,并创建Android.mk, 内容如下:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := xxx

LOCAL_SRC_FILES := libxxx.so

include $(PREBUILT_SHARED_LIBRARY)

3.在project/jni/Android.mk中加入

LOCAL_SHARED_LIBRARIES := xxx

4.在project/jni/android.mk的最后加入

include $(LOCAL_PATH)/prebuilt/Android.mk

5.运行cygwin, 到project目录下, 运行$NDK/ndk-build