[Android12][android-s-preview-1] build error libartservice/Android.bp:36:1[]
问题描述:
同步完android代码后编译出现下面错误
android_trunk$ make -j32
build/make/core/soong_config.mk:193: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead..
build/make/core/soong_config.mk:194: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead..
============================================
PLATFORM_VERSION_CODENAME=S
PLATFORM_VERSION=S
TARGET_PRODUCT=aosp_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-101-generic-x86_64-Ubuntu-14.04.3-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=AOSP.MASTER
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera
============================================
[ 98% 222/225] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja Android.bp
error: art/libartservice/Android.bp:36:1: module "artservice" variant "android_common": depends on //libcore:art.module.api.annotations.for.system.modules which is not visible to this module
You may need to add "//art/libartservice" to its visibility
17:07:59 soong bootstrap failed with: exit status 1
#### failed to build some targets (03:50 (mm:ss)) ####
解决方法
合入google下笔patch
https://android-review.googlesource.com/c/platform/libcore/+/1596234
libcore/JavaLibrary.bp
// A library that contains annotations that define API surfaces (core
// platform, intra core and the hidden API) along with some supporting
// constants. The annotations are source only and do not introduce any runtime
// dependencies. Specially built for use in system modules definitions to
// avoid introducing compile time cycles.
java_library {
name: "art.module.api.annotations.for.system.modules",
visibility: [
"//art/libartservice",
],
srcs: [
":api_surface_annotation_files",
],
installable: false,
sdk_version: "none",
system_modules: "api-annotations-system-modules",
patch_module: "java.base",
}