[cofface]编译Android7.0+更改Java heap Size

Android7.0(也就是Android N)上默认使用JACK编译器,当内存较小的机器编译时可能会出现:

Out of memory error (version 1.2-rc4 ‘Carnac’ (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).
GC overhead limit exceeded.
Try increasing heap size with java option ‘-Xmx’.

此时需要更改Java heap Size,有2种方式任选:

方法1(不需要make clean,export后即可继续make xxxx):

export JACK_SERVER_VM_ARGUMENTS=”-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m”
out/host/linux-x86/bin/jack-admin kill-server
out/host/linux-x86/bin/jack-admin start-server

方法2:

修改源码目录下prebuilts/sdk/tools/jack-admin文件的JACK_SERVER_VM_ARGUMENTS变量,
添加-Xmx4096M(这个根据你自己的内存情况),然后make clean,make -j48重新编译。

 

合作联系邮箱:cofface#cofface.com(请将#替换为@)

转载请注明来源:Cofface Blog » [cofface]编译Android7.0+更改Java heap Size

赞 (39) 打赏

感谢您的支持,我会继续努力的!

支付宝扫一扫打赏