android7.1 编译提示Out of memory error

android7.1 编译systemimage的时候,遇到编译报错

FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp

Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by [email protected])).

GC overhead limit exceeded.

Try increasing heap size with java option '-Xmx'.

Warning: This may have produced partial or corrupted output.

ninja: build stopped: subcommand failed.

make: *** [ninja_wrapper] Error 1

需要增加Java虚拟机的-Xmx大小,即设置一个较大的堆内存上限

方法1:

   修改Jack的配置文件prebuilts/sdk/tools/jack-admin

JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"

修改为

JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"

然后

重新启动jack-server

#先停止服务

./prebuilts/sdk/tools/jack-admin stop-server

#重新开始服务.

/prebuilts/sdk/tools/jack-admin start-server

方法2:

export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation  -Xmx4096m"

然后重新其中jack-server


参考网站:

https://www.cnblogs.com/dinphy/p/6138803.html

你可能感兴趣的:(android7.1 编译提示Out of memory error)