先用test2.cpp生成libhello.so,将该库放在源文件目录下,然后对该库进行再次编译,android.mk文件如下格式:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := foo-prebuilt
LOCAL_SRC_FILES := libhello.so
#LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := foo-user
LOCAL_SRC_FILES := test.cpp
LOCAL_LDLIBS := -llog
LOCAL_SHARED_LIBRARIES := foo-prebuilt
include $(BUILD_SHARED_LIBRARY)
-----------------------------------------------------------------------------------
Application.mk文件如下:
APP_ABI := armeabi-v7a
APP_STL := gnustl_static
之后执行ndk-build即可,最终在armeabi-va7文件夹就会生成如上图的两个库了
如果想导出libhello的头文件加上LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
ps:在l