08:51:06 293 293 hiddenapi.cc:552] Superclass/interface Lkotlin/coroutines/jvm/internal/SuspendLambda; of class Landroidx/window/area/WindowAreaControllerImpl$rearDisplayStatus$1; from dex file "out_sys/soong/.intermediates/frameworks/base/framework-minus-apex/android_common/aligned/framework-minus-apex.jar!classes4.dex" was not found. Either it is missing or it appears later in the classpath spec.
/bin/sh: line 1: 293 Aborted (core dumped) out_sys/host/linux-x86/bin/hiddenapi list --boot-dex=out_sys/soong/.intermediates/packages/modules/IPsec/android.net.ipsec.ike/android_common_com.android.ipsec/aligned/android.net.ipsec.ike.jar --boot-dex=out_sys/soong/.intermediates/external/apache-xml/apache-xml/android_common_apex31/dex-withres-aligned
原因:
Android类加载路径有两个BOOTCLASSPATH,SYSTEMSERVERCLASSPATH,BOOTCLASSPATH先加载。
BOOTCLASSPATH中的jar包如果对SYSTEMSERVERCLASSPATH中的jar包有依赖,则会出现上述错误。
解决办法:
1.将BOOTCLASSPATH中的jar移除,在device.mk中 PRODUCT_BOOT_JARS_EXTRA这个字段中删掉对应模块
2.将SYSTEMSERVERCLASSPATH中的jar包添加到BOOTCLASSPATH,方式如上在PRODUCT_BOOT_JARS_EXTRA中添加
3.将BOOTCLASSPATH中的jar中删除对SYSTEMSERVERCLASSPATH依赖的逻辑
在framework.jar中依赖了其他jar包;添加的jar包又对 SYSTEMSERVERCLASSPATH (services.jar)有依赖。framework.jar是加在了BOOTCLASSPATH路径中的(先加载),所以在编译framework.jar时,在BOOTCLASSPATH路径中找不到services.jar中的类,此时SYSTEMSERVERCLASSPATH中的类还未加载,导致编译报错,这种情况就是无法编译的。