diff --git a/core/definitions.mk b/core/definitions.mk index 441c18630..177dbc771 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1671,9 +1671,10 @@ endef define transform-classes.jar-to-dex @echo "target Dex: $(PRIVATE_MODULE)" @mkdir -p $(dir $@) +$(hide) rm -f $(dir $@)/classes*.dex $(hide) $(DX) \ $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx2048M) \ - --dex --output=$@ \ + --dex --output=$(dir $@) \ $(incremental_dex) \ $(if $(NO_OPTIMIZE_DX), \ --no-optimize) \ @@ -1743,11 +1744,7 @@ endef #TODO: update the manifest to point to the dex file define add-dex-to-package -$(if $(filter classes.dex,$(notdir $(PRIVATE_DEX_FILE))),\ -$(hide) zip -qj $@ $(PRIVATE_DEX_FILE),\ -$(hide) _adtp_classes_dex=$(dir $(PRIVATE_DEX_FILE))classes.dex; \ -cp $(PRIVATE_DEX_FILE) $$_adtp_classes_dex && \ -zip -qj $@ $$_adtp_classes_dex && rm -f $$_adtp_classes_dex) +$(hide) zip -qj $@ $(dir $(PRIVATE_DEX_FILE))/classes*.dex endef # Add java resources added by the current module. diff --git a/core/java.mk b/core/java.mk index 8863ac22b..049bc5110 100644 --- a/core/java.mk +++ b/core/java.mk @@ -72,10 +72,10 @@ intermediates.COMMON := $(call local-intermediates-dir,COMMON) # Choose leaf name for the compiled jar file. ifeq ($(LOCAL_EMMA_INSTRUMENT),true) full_classes_compiled_jar_leaf := classes-no-debug-var.jar -built_dex_intermediate_leaf := classes-no-local.dex +built_dex_intermediate_leaf := no-local else full_classes_compiled_jar_leaf := classes-full-debug.jar -built_dex_intermediate_leaf := classes-with-local.dex +built_dex_intermediate_leaf := with-local endif ifeq ($(LOCAL_PROGUARD_ENABLED),disabled) @@ -96,7 +96,7 @@ emma_intermediates_dir := $(intermediates.COMMON)/emma_out # only the output directory can be changed full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf) full_classes_proguard_jar := $(intermediates.COMMON)/$(proguard_jar_leaf) -built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf) +built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS) @@ -470,7 +470,9 @@ $(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(transform-classes.jar-to-dex) $(built_dex): $(built_dex_intermediate) | $(ACP) @echo Copying: $@ - $(hide) $(ACP) -fp $< $@ + $(hide) mkdir -p $(dir $@) + $(hide) rm -f $(dir $@)/classes*.dex + $(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@) ifneq ($(GENERATE_DEX_DEBUG),) $(install-dex-debug) endif