Android的AIDL编译错误:无法找到类进口 [英] Android Aidl Compile Error: couldn't find import for class
问题描述
(我知道有即将加入parcelable为的NetworkInfo计算器上和其他地方的多个问题(如谷歌组),但这并不是这个。的)
我的工作是在$(AOSP_ROOT)/设备/并且涉及多个 AIDL 文件。它的一个很喜欢,
My work is under $(AOSP_ROOT)/device/ and involves multiple aidl files. one of it is like,
package com.example;
parcelable SomeRequest;
和其他AIDL是喜欢,
And another aidl is like,
package com.example;
import com.example.SomeRequest;
interface SomeService {
SomeRequest getRequest();
}
和我会像编译错误,
device/somedevice/sdk/libs/aidl/com/example/SomeService.aidl:9: couldn't find import for class com.example.SomeRequest
我不知道这是处理AIDL文件的顺序。我Android.mk样子,
I'm wondering it is the order of processing aidl files. My Android.mk looks like,
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, aidl)
LOCAL_AIDL_INCLUDES := $(call all-Iaidl-files-under, aidl)
后,我从SRC /文件夹移动AIDL文件AIDL /文件夹(出于某种原因,我必须这样做)引入此版本错误。即使我把它回的src /文件夹,它不工作了它的工作之前,但现在。我试图清理$(AOSP_ROOT)/输出/设备/目标,但它没有帮助。
This build error is introduced after I moved aidl files from src/ folder to aidl/ folder (for some reason I have to do so). It worked before but now even if I moved it back to src/ folder it doesn't work anymore. I tried to clean up $(AOSP_ROOT)/out/device/target but it's not helping.
想法?
推荐答案
最后我得到了解决。
如果你深入研究 /build/core/base_rules.mk
,你会发现, LOCAL_AIDL_INCLUDES
实际上是期间AIDL除了状框架左右默认文件夹编译阶段被包括在文件夹。
If you dig into /build/core/base_rules.mk
, you'll find that LOCAL_AIDL_INCLUDES
is actually the folders to be included during AIDL compiling phase in addition to the default folders like framework or so.
$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
在这种特殊情况下,你想要的其实是,
In this specific case, what you want is actually,
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, aidl)
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl
这篇关于Android的AIDL编译错误:无法找到类进口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!