不過,這麼一來編譯 Android 4.0 (ICS) 時可能會遇上如下的錯誤:
target Dex: core Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. make: *** [out/target/common/obj/JAVA_LIBRARIES/core_intermediates/noproguard.classes-with-local.dex] Error 1
這個容易處理,修改 build/core/definitions.mk 這個檔案是可以解決的,修改方式如下:
diff --git a/build/core/definitions.mk b/build/core/definitions.mk index b678158..b83b299 100644 --- a/build/core/definitions.mk +++ b/build/core/definitions.mk @@ -1525,7 +1525,7 @@ define transform-classes.jar-to-dex @echo "target Dex: $(PRIVATE_MODULE)" @mkdir -p $(dir $@) $(hide) $(DX) \ - $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx2048M) \ + $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx1024M) \ --dex --output=$@ \ $(incremental_dex) \ $(if $(NO_OPTIMIZE_DX), \
也可用SWAP的方式
回覆刪除dd if=/dev/zero of=/data/6GB.swap bs=1024 count=6144000
mkswap /data/6GB.swap
swapon /data/6GB.swap