Android预编译调用第三方库
在同一个Android.mk
中编写就行:
LOCAL_PATH:= $(call my-dir)
#此段是预编译第三方库部分
include $(CLEAR_VARS)
LOCAL_MODULE := libaspmodule
LOCAL_MODULE_TAGS := optional
#LOCAL_SRC_FILES := libaspmodule.so
#32位、64位两者都编译
LOCAL_MULTILIB := both
LOCAL_SRC_FILES_arm:= armeabi-v7a/libaspmodule.so
LOCAL_SRC_FILES_arm64:= arm64-v8a/libaspmodule.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_MODULE_STEM :=$(LOCAL_MODULE)
LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
include $(BUILD_PREBUILT)
#此段是预编译第三方静态库部分
include $(CLEAR_VARS)
LOCAL_MODULE := libnexsound
#LOCAL_SRC_FILES := libnexsound.a
#32位、64位两者都编译
LOCAL_MULTILIB := both
LOCAL_SRC_FILES_arm:= armeabi-v7a/libnexsound.a
LOCAL_SRC_FILES_arm64:= arm64-v8a/libnexsound.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX:=.a
include $(BUILD_PREBUILT)
#此段是调用前面第三方库编译JNI生成a和so部分
include $(CLEAR_VARS)
LOCAL_C_INCLUDES:= external/tinyalsa/include
LOCAL_SRC_FILES:= com_ecovacs_lib_digmic_DigMic.c
LOCAL_MODULE := libdigmic
LOCAL_SHARED_LIBRARIES:= libcutils libutils libtinyalsa libaspmodule
LOCAL_STATIC_LIBRARIES := libnexsound
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
我最擅长从零开始创造世界,所以从来不怕失败,它最多也就让我一无所有。