Ubuntu14.04 Android7.0 编译 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




1.安装openjdk 1.8

14.04的版本无法直接安装openjdk 1.8 

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update 

sudo apt-get install openjdk-8-jdk
安装完成后用这个来切换

sudo update-alternatives --config java
sudo update-alternatives --config javac
2. 8G内存以下的电脑编译问题

android/prebuilts/sdk/tools/jack-admin

加上下面这个-Xmx3g

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"


你可能感兴趣的:(Android7.0,framework,环境配置)