解决方法
如果模块将路径添加到LOCAL_EXPORT_C_INCLUDES,则这些路径将添加到另一个模块的LOCAL_C_INCLUDES定义中,该模块使用LOCAL_STATIC_LIBRARIES或LOCAL_SHARED_LIBRARIES.
考虑我们有2个模块,例如foo和bar以及是树结构.
. |-- Android.mk |-- bar | |-- bar.c | |-- bar.h |-- foo |-- foo.c `-- foo.h
bar使用foo作为静态库.由于bar.c需要包含foo.h,因此foo模块必须添加LOCAL_EXPORT_C_INCLUDES的包含路径.如果任何模块都没有使用bar,那么它可以添加到LOCAL_C_INCLUDES的包含路径.
Android.mk将如下所示:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := foo LOCAL_SRC_FILES := foo/foo.c LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := bar LOCAL_SRC_FILES := bar/bar.c LOCAL_C_INCLUDES := $(LOCAL_PATH)/bar LOCAL_STATIC_LIBRARIES := foo include $(BUILD_SHARED_LIBRARY)
请看一下android-ndk示例目录中提供的示例:android-ndk-r9d / samples / module-exports