From e58539749731157a29eafea62662a399adc8bb28 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Tue, 1 Mar 2016 12:06:47 -0800 Subject: [PATCH] Calls aapt2 when a static Java library has LOCAL_STATIC_ANDROID_LIBRARIES We expect to build the module's own packare-res.apk from the LOCAL_STATIC_ANDROID_LIBRARIES in this case. Bug: 25958912 Change-Id: I4d0294c867f5fb636983d630493a3b188279cae9 --- core/package_internal.mk | 2 +- core/static_java_library.mk | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/package_internal.mk b/core/package_internal.mk index 2ffbcd4d9..0c105e298 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -150,7 +150,7 @@ all_resources := $(strip $(my_res_resources) $(my_overlay_resources)) my_res_package := $(intermediates)/package-res.apk LOCAL_INTERMEDIATE_TARGETS += $(my_res_package) -# Always run aapt2 +# Always run aapt2, because we need to at least compile the AndroidManifest.xml. need_compile_res := true else # LOCAL_USE_AAPT2 diff --git a/core/static_java_library.mk b/core/static_java_library.mk index 0b521d541..a9b21aeab 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -38,7 +38,14 @@ need_compile_res := # A static Java library needs to explicily set LOCAL_RESOURCE_DIR. ifdef LOCAL_RESOURCE_DIR need_compile_res := true +endif +ifdef LOCAL_USE_AAPT2 +ifneq ($(LOCAL_STATIC_ANDROID_LIBRARIES),) +need_compile_res := true +endif +endif +ifeq ($(need_compile_res),true) all_resources := $(strip \ $(foreach dir, $(LOCAL_RESOURCE_DIR), \ $(addprefix $(dir)/, \