android NDK编译.a静态库

【1】android mk文件如果调用一个.a静态库的相关函数,可将其进行如下处理:
LOCAL_PATH := $(call my-dir)

# libnxclient_apps_utils.a
# ==============================================================================
include $(CLEAR_VARS)
LOCAL_PREBUILT_LIBS :=  libnxclient_apps_utils:libnxclient_apps_utils.a
LOCAL_MODULE_TAGS := optional
include $(BUILD_MULTI_PREBUILT)

注意.a静态库命名一定要有前缀lib

【2】若要将其编译到so共享库,则可以
include $(CLEAR_VARS)
LOCAL_MODULE := libnxclient_apps_utils
LOCAL_MODULE_TAGS := optional
LOCAL_WHOLE_STATIC_LIBRARIES := libnxclient_apps_utils
include $(BUILD_SHARED_LIBRARY)

【3】若要在编译一个bin程序时引用,也只需要:
LOCAL_WHOLE_STATIC_LIBRARIES := libnxclient_apps_utils


【4】当然也需要包含该.a文件所需的h文件目录
LOCAL_C_INCLUDES

你可能感兴趣的:(android)