[RK3399][Android7.1] Ubuntu编译环境内存要求

Platform: RK3399
OS: Android 7.1
Platform: Firefly-RK3399


现象
本地编译Android 7.1时出现如下错误:

[  2% 764/34600] Building with Jack: out/targe...framework_intermediates/with-local/classes.dex
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.
[  2% 764/34600] build out/target/common/obj/J...A_LIBRARIES/sdk_v19_intermediates/classes.jack
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1

原因
内存不足,官网也有说明了,至少需要16GB RAM。

[RK3399][Android7.1] Ubuntu编译环境内存要求_第1张图片


解决办法一
物理增加PC内存到16GB以上

解决方法二

kris@eco:~/firefly_rk3399/prebuilts/sdk/tools$ g df jack-admin 
diff --git a/prebuilts/sdk/tools/jack-admin b/prebuilts/sdk/tools/jack-admin
index ee193fc..214fff7 100755
--- a/prebuilts/sdk/tools/jack-admin
+++ b/prebuilts/sdk/tools/jack-admin
@@ -26,7 +26,7 @@ umask 077
 JACK_HOME="${JACK_HOME:=$HOME/.jack-server}"
 CLIENT_SETTING="${CLIENT_SETTING:=$HOME/.jack-settings}"
 TMPDIR=${TMPDIR:=/tmp}
-JACK_SERVER_VM_ARGUMENTS="${JACK_SERVER_VM_ARGUMENTS:=-Dfile.encoding=UTF-8 -XX:+TieredCompilation}"
+JACK_SERVER_VM_ARGUMENTS="${JACK_SERVER_VM_ARGUMENTS:=-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g}"
 JACK_EXTRA_CURL_OPTIONS=${JACK_EXTRA_CURL_OPTIONS:=}

 LAUNCHER_JAR="$JACK_HOME/launcher.jar"
@@ -451,7 +451,7 @@ case $COMMAND in
     if [ "$RUNNING" = 0 ]; then
       echo "Server is already running"
     else
-      JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $
+      JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4g -cp $LAUNCHE
       echo "Launching Jack server" $JACK_SERVER_COMMAND
       (
         trap "" SIGHUP

注意: 编译之前先要关闭后台的Jack服务
kris@eco:~/firefly_rk3399/$ ./prebuilts/sdk/tools/jack-admin kill-server


参考
Android source code compile error: “Try increasing heap size with java option ‘-Xmx’”
Msm8937+android7.1.1编译环境搭建及编译

你可能感兴趣的:(子类__Build,RK3399)