美文网首页Android Utils
编译 Android 源码遇到 Xmx 错误的快速处理方案

编译 Android 源码遇到 Xmx 错误的快速处理方案

作者: 几千里也 | 来源:发表于2017-11-30 13:43 被阅读2次
    Try increasing heap size with java option '-Xmx<size>'.
    Warning: This may have produced partial or corrupted output.
    [ 60% 38768/63594] build out/target/common/obj/JAVA_LIBRARIES/amap_loc_intermediates/classes.jack
    ninja: build stopped: subcommand failed.
    make: *** [ninja_wrapper] Error 1
    

    出现 Xmx 错误是由于电脑内存不足,一般在命令行执行以下三条语句再编译就行了。

    export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
    ./prebuilts/sdk/tools/jack-admin kill-server
    ./prebuilts/sdk/tools/jack-admin start-server
    

    以下内容是我工作环境的备忘,可以忽略。

    ~/.jack

    # Server settings
    SERVER=true
    SERVER_PORT_SERVICE=8072
    SERVER_PORT_ADMIN=8073
    SERVER_COUNT=1
    SERVER_NB_COMPILE=2
    SERVER_TIMEOUT=120
    SERVER_LOG=${SERVER_LOG:=$SERVER_DIR/jack-$SERVER_PORT_SERVICE.log}
    JACK_VM_COMMAND=${JACK_VM_COMMAND:="java -Xmx4096m"}
    # Internal, do not touch
    SETTING_VERSION=2
    

    ~/.jack-settings

    # Server settings
    SERVER_HOST=127.0.0.1
    SERVER_PORT_SERVICE=8072
    SERVER_PORT_ADMIN=8073
    
    # Internal, do not touch
    SETTING_VERSION=4
    

    ~/.bashrc

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

    find jack

    ps -ef| grep -i com.android.jack.launcher
    

    restart jack

    kill jack_process
    your_out/host/linux-x86/bin/jack-admin start
    

    Jack Server not report error after using jack 4.7beta (>_<)

    1. kill your jack server
    2. copy the old jack command to  your_out/host/linux-x86/bin/
    

    相关文章

      网友评论

        本文标题:编译 Android 源码遇到 Xmx 错误的快速处理方案

        本文链接:https://www.haomeiwen.com/subject/gnjvbxtx.html