九鼎创展论坛
标题:
Android编译错误之java.lang.OutOfMemoryError: Java heap space,解决方案
[打印本页]
作者:
jjj
时间:
2013-2-27 13:13
标题:
Android编译错误之java.lang.OutOfMemoryError: Java heap space,解决方案
在编译Android系统时,特别是Android4.0时,比较容易出现如下错误,解决方案如下:
方法一:
diff --git a/android4.0/build/tools/releasetools/common.py b/android4.0/build/tools/releasetools/common.py
index 4957354..aacb18c 100644
--- a/android4.0/build/tools/releasetools/common.py
+++ b/android4.0/build/tools/releasetools/common.py
@@ -355,7 +355,7 @@ def SignFile(input_name, output_name, key, password, align=None,
else:
sign_name = output_name
- cmd = ["java", "-Xmx2048m", "-jar",
+ cmd = ["java", "-Xmx256m", "-jar",
os.path.join(OPTIONS.search_path, "framework", "signapk.jar")]
if whole_file:
cmd.append("-w")
复制代码
如还异常,则尝试方法二:
diff --git a/android4.0/build/core/definitions.mk b/android4.0/build/core/definitions.mk
index 683ae16..3b3d6f9 100644
--- a/android4.0/build/core/definitions.mk
+++ b/android4.0/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 -JXmx1536M) \
+ $(if $(findstring windows,$(HOST_OS)),,-JXms1024M -JXmx2048M) \
--dex --output=$@ \
$(incremental_dex) \
$(if $(NO_OPTIMIZE_DX), \
复制代码
欢迎光临 九鼎创展论坛 (http://bbs.9tripod.com/)
Powered by Discuz! X3.2