AOSP 构建错误:未定义符号
Posted
技术标签:
【中文标题】AOSP 构建错误:未定义符号【英文标题】:AOSP building error: symbol not defined 【发布时间】:2015-12-03 06:33:27 【问题描述】:我正在尝试基于 AOSP 4.3_r2.2 构建 cornerstone。我在构建过程中遇到了很多错误,如下所示:
frameworks/base/core/res/res/values/public.xml:244: error: Symbol 'config_bluetooth_adapter_quick_switch' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1558: error: Symbol 'config_enableDreams' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:919: error: Symbol 'ic_suggestions_add' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:920: error: Symbol 'ic_suggestions_delete' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1244: error: Symbol 'backspace' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1250: error: Symbol 'carrier' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:130: error: Symbol 'dangerous_perms_list' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1253: error: Symbol 'emergencyCallButton' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1254: error: Symbol 'faceLockAreaView' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1256: error: Symbol 'forgotPatternButton' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1258: error: Symbol 'headerText' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1260: error: Symbol 'instructions' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:1263: error: Symbol 'lockPattern' declared with <java-symbol> not defined
frameworks/base/core/res/res/values/public.xml:131: error: Symbol 'non_dangerous_perms_list' declared with <java-symbol> not defined
...
make: *** [out/target/common/obj/APPS/framework-res_intermediates/package-export.apk] Error 1
make: *** Deleting file `out/target/common/obj/APPS/framework-res_intermediates/package-export.apk'
make: *** Waiting for unfinished jobs....
我在这里搜索并找到了这个issue。所以我知道这可能缺少符号定义问题。但是当我查看 public.xml 时,我发现它们属于不同的类型:
<java-symbol type="bool" name="config_bluetooth_sco_off_call" />
<java-symbol type="bool" name="config_enableDreams" />
<java-symbol type="drawable" name="ic_suggestions_add" />
<java-symbol type="drawable" name="ic_suggestions_delete" />
<java-symbol type="id" name="backspace" />
<java-symbol type="id" name="carrier" />
<java-symbol type="id" name="dangerous_perms_list" />
...
我还发现frameworks/base/core/res/MakeJavaSymbols.sed有一个脚本文件,上面写着命令
make framework 2>&1 | sed -n -f MakeJavaSymbols.sed | sort -u
可用于生成缺失的资源。我搜索了很多,我发现只是为了运行这个命令,它会输出丢失的部分。但我跑了,什么也没发生。所以我的问题是我应该在哪里以及如何添加这些缺失的符号?有几百个,我需要手动添加吗?我错过了什么吗?由于我是AOSP框架的新手,所以请帮忙。
【问题讨论】:
【参考方案1】:终于解决了这个问题,做了这些: 1.从public.xml中移除符号定义; 2.将android.view.Surface替换为android.view.SurfaceControl,WindowManagerService.DEFAULT_DIM_DURATION替换为WindowAnimator.DEFAULT_DIM_DURATION。
之后编译成功,可以运行了,虽然还是有一些问题。
【讨论】:
以上是关于AOSP 构建错误:未定义符号的主要内容,如果未能解决你的问题,请参考以下文章
在 Xcode 4 下构建 PhoneGap 时出现未定义符号错误?
错误:预期类型 - eventDispatcher:(nonnull RCTEventDispatcher *)eventDispatcher;在 iOS 构建期间出现“未定义符号”错误
使用 openCV 构建 Bazel,错误:架构 x86_64 的未定义符号
在 Xcode 中构建反应本机项目的问题 - 错误:找不到自动链接库 + 未定义符号等