2G内存编译android4.0

http://blog.csdn.net/leerobin83/article/details/7873229

1、Error occurred during initialization of VM 
Could not reserve enough space for object heap
从字面上看是在初始化java Vm的时候不能获取足够的堆空间,于是修改了build/core/definition.mk文件中的编译core.jar和framework.jar时需要的-JXmx为1024m,此参数代表编译上述两个包时需要的最大内存,此初始值为2048M,由于我的PC电脑总的内存才2G,系统运行会占据一部分内存,故编译android的时候肯定不会分配2G内存,
解决:

把build/core/definitions.mk  文件

第1528行:$(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx2048M) \

改成:      $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx1024M) \

 

2、target Dex: framework
make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/noproguard.classes-with-local.dex] 已杀死
解决增加虚拟内存:
sudo dd if=/dev/zero of=/swapfile bs=1024 count=512M
mkswap  /swapfile
swapon  /swapfile

把swapfile写入/etc/fstab 文件,在后面加入/swapfile swap swap defaults 0 0

 

3、running:  java -Xmx2048m -jar out/host/linux-x86/framework/signapk.jar -w build/target/product/security/testkey.x509.pem build/target/product/security/testkey.pk8 /tmp/tmpgsmbIJ out/target/product/phs100/phs100-ota-eng.guihua.zip
Could not create the Java virtual machine.

make: *** [out/target/product/phs100/phs100-ota-eng.guihua.zip] ?? 1
解决 build/tools/releasetools/common.py 
Try changing "java -Xmx2048m" in common.py to "java -Xmx1024m" if that fails try "java -Xmx512m" located in /build/tools/releasetools/common.py
grep用法:grep –rE sting ./*

2G内存编译android4.0,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。