如何使用.so文件从一个项目到另一个项目

时间:2013-11-19 10:12:35

标签: android dll android-ndk shared-libraries

我正在尝试将使用NDK生成的.so链接到我正在尝试创建的新.so,因为旧的.so包含我的函数定义想要在新的.so中使用。

1 个答案:

答案 0 :(得分:1)

Android.mk中使用这样的内容应该这样做:

# Use the sub library as a prebuilt shared library
include $(CLEAR_VARS)
LOCAL_MODULE := MySubLibrary
LOCAL_SRC_FILES = /path/to/sub/library.so
LOCAL_EXPORT_C_INCLUDES := /path/to/sub/library/includes
include $(PREBUILT_SHARED_LIBRARY)

# Build your own library referencing your sub library
include $(CLEAR_VARS)
LOCAL_MODULE := MyFinalLibrary
LOCAL_SHARED_LIBRARIES := MySubLibrary
# Add your source files etc here...
include $(BUILD_SHARED_LIBRARY)

希望这有帮助!