AOSP building error: symbol not defined

AOSP building error: symbol not defined

我正在尝试基于 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.删​​除了public.xml中的符号定义; 2. 将 android.view.Surface 替换为 android.view.SurfaceControl,将 WindowManagerService.DEFAULT_DIM_DURATION 替换为 WindowAnimator.DEFAULT_DIM_DURATION。

之后我编译成功了,可以运行,虽然还有一些问题