From 45bb10c47090b71a5e062757cb166b0b74dbf39c Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Thu, 3 May 2018 01:47:35 +0900 Subject: [PATCH] When building unbundled apps, link to the prebuilt stubs lib There was a bug that when an unbundled app is built without SDK (LOCAL_SDK_VERSION isn't set), it is linked to the nonexisting stubs library from java_sdk_library. The built stubs libs are not created for unbundled builds. For unbundled builds, we need to use the prebuilt stubs lib. Bug: 77575606 Test: m -j Test: make -j dist ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk Change-Id: I70cced1c872053e151fea157e3a6d218b1fab9dc --- core/java_common.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/java_common.mk b/core/java_common.mk index d8f679a824..b75949a1f9 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -259,9 +259,14 @@ ifndef LOCAL_IS_HOST_MODULE LOCAL_JAVA_LIBRARIES := $(filter-out $(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES),$(LOCAL_JAVA_LIBRARIES)) my_system_modules := $(DEFAULT_SYSTEM_MODULES) endif # LOCAL_NO_STANDARD_LIBRARIES - # When SDK libraries are referenced from modules built without SDK, provide the system stub to them - # because it has the largest API surface. - sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(lib_name).stubs.system) + + ifneq (,$(TARGET_BUILD_APPS)) + sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,system_current,$(lib_name))) + else + # When SDK libraries are referenced from modules built without SDK, provide the system stub to them + # because it has the largest API surface. + sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(lib_name).stubs.system) + endif else ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) $(call pretty-error,Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)