diff --git a/core/definitions.mk b/core/definitions.mk index 81f2460b2..cb263c315 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2552,7 +2552,8 @@ $(hide) rm -f $@ $@.tmp $(hide) java -jar $(DESUGAR) \ $(addprefix --bootclasspath_entry ,$(call desugar-bootclasspath,$(PRIVATE_BOOTCLASSPATH))) \ $(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_LIBRARIES)) \ - --min_sdk_version 24 --allow_empty_bootclasspath \ + --min_sdk_version $(PRIVATE_SDK_VERSION) \ + --allow_empty_bootclasspath \ $(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \ -i $< -o $@.tmp mv $@.tmp $@ @@ -2568,6 +2569,7 @@ $(hide) rm -f $(dir $@)classes*.dex $(hide) $(DX) \ -JXms16M -JXmx2048M \ --dex --output=$(dir $@) \ + --min-sdk-version=$(PRIVATE_SDK_VERSION) \ $(if $(NO_OPTIMIZE_DX), \ --no-optimize) \ $(if $(GENERATE_DEX_DEBUG), \ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 503f67bdf..72dfceed8 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -133,6 +133,15 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) $(add-dex-to-package) endif # !LOCAL_IS_STATIC_JAVA_LIBRARY + +ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION) +else +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION) +endif + else # LOCAL_JACK_ENABLED $(LOCAL_INTERMEDIATE_TARGETS): \ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc diff --git a/core/java.mk b/core/java.mk index ea816397a..2864e569a 100644 --- a/core/java.mk +++ b/core/java.mk @@ -706,6 +706,14 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html) endif # full_classes_jar is defined +ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION) +else +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION) +endif + ifdef LOCAL_JACK_ENABLED $(LOCAL_INTERMEDIATE_TARGETS): \ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc diff --git a/core/package_internal.mk b/core/package_internal.mk index 61994d5fb..bfcd5acf9 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -307,13 +307,6 @@ endif $(LOCAL_INTERMEDIATE_TARGETS): \ PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) -ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) -$(LOCAL_INTERMEDIATE_TARGETS): \ - PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) -else -$(LOCAL_INTERMEDIATE_TARGETS): \ - PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) -endif ifeq ($(LOCAL_DATA_BINDING),true) data_binding_stamp := $(data_binding_intermediates)/data-binding.stamp diff --git a/core/static_java_library.mk b/core/static_java_library.mk index d294e696a..4dec1a853 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -141,12 +141,6 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediate $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) -ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) -else -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) -endif - $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME :=