包括来自预建库的头文件 Android.mk
including header files from prebuilt library Android.mk
我使用
在我的库创建中包含了一个预建库
include $(PREBUILT_SHARED_LIBRARY)
并通过使用
验证是否包含天气库
$(modules-get-list)
当我尝试在预建库中包含头文件时,我遇到找不到头文件的错误。下面是我的确切 Android.mk 文件
LOCAL_PATH := $(call my-dir)
# import prebuilt-library
include $(CLEAR_VARS)
LOCAL_MODULE := prebuilt-library
LOCAL_SRC_FILES := ../../../target/dependency/libs/$(TARGET_ARCH_ABI)/libprebuilt.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
# building provider interface library for communication
include $(CLEAR_VARS)
LOCAL_MODULE := library-interface
LOCAL_SRC_FILES := LibraryComminicator.cpp
LOCAL_SHARED_LIBRARIES := prebuilt-library
include $(BUILD_SHARED_LIBRARY)
$(warning Existing modules: "$(modules-get-list)")
# Include the Android Maven plugin generated makefile
# Important: Must be the last import in order for Android Maven Plugins paths to work
include $(ANDROID_MAVEN_PLUGIN_MAKEFILE)
试试下面的Android.mk:
LOCAL_PATH := $(call my-dir)
EXT_LIB_ROOT := $(LOCAL_PATH)/../../../target/dependency # or whatever
# building provider interface library for communication
include $(CLEAR_VARS)
LOCAL_MODULE := library-interface
LOCAL_SRC_FILES := LibraryComminicator.cpp
LOCAL_SHARED_LIBRARIES := prebuilt-library
include $(BUILD_SHARED_LIBRARY)
# import prebuilt-library
LOCAL_PATH := $(EXT_LIB_ROOT)
include $(CLEAR_VARS)
LOCAL_MODULE := prebuilt-library
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libprebuilt.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
$(warning Existing modules: "$(modules-get-list)")
基本规则是:xxx_INCLUDE_FILES 应该是相对于 'current dir',而 LOCAL_SRC_FILES 是相对于 $(LOCAL_PATH),而不是 'current dir'.使用 NDK,通常 'current dir' 是 $(LOCAL_PATH)/..
但这可能会改变,特别是如果 Android.mk 文件被链接,即一个包含另一个。
PREBUILT_SHARED_LIBRARY 模块确实不需要 LOCAL_PATH,但我希望 LOCAL_SRC_FILES 尽可能短。
我使用
在我的库创建中包含了一个预建库include $(PREBUILT_SHARED_LIBRARY)
并通过使用
验证是否包含天气库$(modules-get-list)
当我尝试在预建库中包含头文件时,我遇到找不到头文件的错误。下面是我的确切 Android.mk 文件
LOCAL_PATH := $(call my-dir)
# import prebuilt-library
include $(CLEAR_VARS)
LOCAL_MODULE := prebuilt-library
LOCAL_SRC_FILES := ../../../target/dependency/libs/$(TARGET_ARCH_ABI)/libprebuilt.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
# building provider interface library for communication
include $(CLEAR_VARS)
LOCAL_MODULE := library-interface
LOCAL_SRC_FILES := LibraryComminicator.cpp
LOCAL_SHARED_LIBRARIES := prebuilt-library
include $(BUILD_SHARED_LIBRARY)
$(warning Existing modules: "$(modules-get-list)")
# Include the Android Maven plugin generated makefile
# Important: Must be the last import in order for Android Maven Plugins paths to work
include $(ANDROID_MAVEN_PLUGIN_MAKEFILE)
试试下面的Android.mk:
LOCAL_PATH := $(call my-dir)
EXT_LIB_ROOT := $(LOCAL_PATH)/../../../target/dependency # or whatever
# building provider interface library for communication
include $(CLEAR_VARS)
LOCAL_MODULE := library-interface
LOCAL_SRC_FILES := LibraryComminicator.cpp
LOCAL_SHARED_LIBRARIES := prebuilt-library
include $(BUILD_SHARED_LIBRARY)
# import prebuilt-library
LOCAL_PATH := $(EXT_LIB_ROOT)
include $(CLEAR_VARS)
LOCAL_MODULE := prebuilt-library
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libprebuilt.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
$(warning Existing modules: "$(modules-get-list)")
基本规则是:xxx_INCLUDE_FILES 应该是相对于 'current dir',而 LOCAL_SRC_FILES 是相对于 $(LOCAL_PATH),而不是 'current dir'.使用 NDK,通常 'current dir' 是 $(LOCAL_PATH)/..
但这可能会改变,特别是如果 Android.mk 文件被链接,即一个包含另一个。
PREBUILT_SHARED_LIBRARY 模块确实不需要 LOCAL_PATH,但我希望 LOCAL_SRC_FILES 尽可能短。