Ubuntu14.04编译Android7.1报错:Out of memory error

FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp
Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by [email protected])).
Java heap space.
Try increasing heap size with java option '-Xmx'.
Warning: This may have produced partial or corrupted output.
[ 23% 17231/73086] build out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack
[ 23% 17231/73086] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/cr_intermediates/classes.jack
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1




 8G内存以下的电脑编译问题,在android/prebuilts/sdk/tools/目录下找到jack-admin,双击打开该文件,添加以下红色内容,该文件的内容比较多,一定要看仔细了


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 -Xmx3g}"
JACK_EXTRA_CURL_OPTIONS=${JACK_EXTRA_CURL_OPTIONS:=}



  start-server)
    if [ ! -d "$JACK_HOME" ]; then
      echo "Jack server installation not found" >&2
      abort
    fi


    isServerRunning
    RUNNING=$?
    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 -Xmx3g-cp $LAUNCHER_JAR $LAUNCHER_NAME"



如果以上方法还没有解决问题,需要添加交换分区swap,分配空间16G.重装系统重新分区。然后再执行以上内容。


转载自http://blog.csdn.net/aaron121314/article/details/71439803

你可能感兴趣的:(ubuntu)