Android P构建失败-apache-xml_intermediates-hiddenapi

问题描述

Ubuntu 18.04

Android P

repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r60

你知道这里发生了什么吗?我猜这在Java环境中是有区别的,因为hiddenapi二进制文件似乎失败了,但是该构建似乎正在拾取捆绑在源代码树中的Java,因此它应该可以工作。在此构建之前,我删除了所有Java软件包。我需要安装一些吗?我能够在某个时候取得成功,但无法在干净的机器上恢复原状。预先感谢。

Parsing out/target/product/arm64/obj/ETC/sepolicy_neverallows_intermediates/plat_pub_policy.cil
Parsing out/target/product/arm64/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_policy_raw.cil
[ 83% 63419/76082] Target cache fs image: out/target/product/arm64/cache.img
WARNING: out/target/product/arm64/cache.img approaching size limit (69206016 now; limit 69206016)
[ 85% 64672/75715] build out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/classes.dex
FAILED: out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/classes.dex 
/bin/bash -c "(rm -rf out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ ) && (mkdir -p out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ ) && (find out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex/ -maxdepth 1 -name \"classes*.dex\" | sort | xargs -I{} cp -f {} out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ ) && (find out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ -name \"classes*.dex\" | sort | sed 's/^/--dex=/' | xargs out/host/linux-x86/bin/hiddenapi --light-greylist=out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt --dark-greylist=out/target/common/obj/PACKAGING/hiddenapi-dark-greylist.txt --blacklist=out/target/common/obj/PACKAGING/hiddenapi-blacklist.txt )"
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47] No DEX files specified
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47] Command: out/host/linux-x86/bin/hiddenapi --light-greylist=out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt --dark-greylist=out/target/common/obj/PACKAGING/hiddenapi-dark-greylist.txt --blacklist=out/target/common/obj/PACKAGING/hiddenapi-blacklist.txt
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47] Usage: hiddenapi [options]...
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47] 
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]   --dex=<filename>: specify dex file whose members' access flags are to be set.
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]       At least one --dex parameter must be specified.
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47] 
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]   --light-greylist=<filename>:
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]   --dark-greylist=<filename>:
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]   --blacklist=<filename>: text files with signatures of methods/fields to be marked
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]       greylisted/blacklisted respectively. At least one list must be provided.
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47] 
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]   --print-hidden-api: dump a list of marked methods/fields to the standard output.
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47]       There is no indication which API category they belong to.
hiddenapi E 11-08 12:34:51 29841 29841 hiddenapi.cc:47] 
[ 85% 64679/75707] //libcore:core-oj d8 [common]
ninja: build stopped: subcommand failed.
12:35:01 ninja failed with: exit status 1

#### failed to build some targets (02:49:08 (hh:mm:ss)) ####

sburke@sburke-xps:~/sandbox/a/pie$ java --version 
openjdk 9
OpenJDK Runtime Environment (build 9+181-android4627429)
OpenJDK 64-Bit Server VM (build 9+181-android4627429,mixed mode)
sburke@sburke-xps:~/sandbox/a/pie$ which java 
/home/sburke/sandbox/a/pie/prebuilts/jdk/jdk9/linux-x86/bin/java

解决方法

我在XDA论坛上发现这个问题可以在重新启动构建后修复: https://forum.xda-developers.com/t/xperia-open-project-and-gapps-help-wanted.3870751/#post-78284912

它没有帮助我,但我能够通过逐步解决 Ubuntu 20.04 LTS 上的问题,即清理失败的模块,然后只构建这个特定的模块:

$ make clean-apache-xml
$ make apache-xml

在那之后,我在另一个模块 - ims-common 上遇到了同样的问题。我对这个包做了同样的事情,在成功构建 apache-xml 之后,我能够完成 AOSP 构建:

$ make clean-ims-common
$ make ims-common
$ make apache-xml
$ make -j12
,

我在 Ubuntu 20.04 LTS 上构建 LineageOS 16(基于 Android 9)时遇到了同样的问题。

我可以确认 Anton's solution 在这种情况下也有效。此外,我每天都使用我的构建,我没有发现任何问题。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...