您还需要将其添加到 LOCAL_SRC_FILES 中,例如:
LOCAL_SRC_FILES := $(call all-java-files-under, src) src/com/someapp/SomeInfo.aidl
LOCAL_AIDL_INCLUDES := src/com/someapp/SomeInfo.aidl
或者您可以使用预定义的函数,例如:
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src)
LOCAL_AIDL_INCLUDES := $(call all-Iaidl-files-under, src)
让我添加更多细节。实际上 base_rules.mk 是处理aidl文件的一个定义规则:http ://androidxref.com/4.4.3_r1.1/xref/build/core/base_rules.mk#178 。它会自动拾取所有带有aidl扩展名的文件,如下所示:
aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
而您要添加aidl文件的LOCAL_AIDL_INCLUDES列表实际上被定义为AIDL编译器的-I*参数:
$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))