Increasing heap size while building the android source code on Ubuntu 15.10

后端 未结 5 1891
闹比i
闹比i 2020-12-02 12:24

I am trying to build the android source code in ubuntu 15.10, but I got an error. Now I want your help to build the android source code.

including ./tools/ex         


        
相关标签:
5条回答
  • 2020-12-02 13:10

    If you are building Android N then Jack config files is changed. apply above suggested configs by following Transition Guide.

    find the config you want to change, find where it moved from $HOME/.jack and change it there.

    Transitioning from server 1.1 (e.g. Marshmallow) to server 1.3 (e.g. N)

    The old Jack server used a $HOME/.jack configuration file. It has now replaced by a $HOME/.jack-settings and a $HOME/.jack-server/config.properties.

    If those new files do not exist,

    run jack-admin start-server and they will be created.

    If you had custom settings in your $HOME/.jack, here's how to adapt those.

    Step 1

    SERVER_PORT_SERVICE=XXXX Replace with SERVER_PORT_SERVICE=XXXX in $HOME/.jack-settings and jack.server.service.port=XXXX in $HOME/.jack-server/config.properties.

    Step 2

    SERVER_PORT_ADMIN=YYYY Replace with SERVER_PORT_ADMIN=YYYY in $HOME/.jack-settings and jack.server.admin.port=YYYY in $HOME/.jack-server/config.properties.

    Step 3

    SERVER_NB_COMPILE=N Replace with jack.server.max-service=N in $HOME/.jack-server/config.properties.

    Extra Settings

    SERVER_TIMEOUT=ZZ You can replace with jack.server.time-out=ZZ, but it is recommended to keep the default setting of “7200” (2 hours).

    Other settings in the $HOME/.jack configuration file do not need to be copied. You should still keep your $HOME/.jack configuration file for the old Jack server because both server versions can run simultaneously.

    Taken from Jack server , more on Compiling with Jack

    0 讨论(0)
  • 2020-12-02 13:12

    I've just run into same problem.

    The problem is that virtual machine which runs jack doesn't have enough memory.

    You can try to edit jvm command:

    JACK_VM_COMMAND=${JACK_VM_COMMAND:="java -Xmx4096m"}
    

    or to decrease number of parallel jack compilations

    SERVER_NB_COMPILE=2
    

    in ~/.jack file.

    You can read jack documentation for details.

    EDIT: Changing .jack file didn't work for me. After digging a little deeper I found that jack server is started with out/host/linux-x86/bin/jack-admin script and it's parameters can be passed with JACK_SERVER_VM_ARGUMENTS environment variable.

    So my solution was to set it and restart jack server before building aosp :

    export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
    out/host/linux-x86/bin/jack-admin kill-server
    out/host/linux-x86/bin/jack-admin start-server
    
    0 讨论(0)
  • 2020-12-02 13:19

    Just try add

    export ANDROID_JACK_VM_ARGS="-Xmx8192m -Xms512m -Dfile.encoding=UTF-8 -XX:+TieredCompilation"
    

    to the end of .bashrc and reboot Linux

    0 讨论(0)
  • 2020-12-02 13:27

    jack_server_setup.mk under prebuilts\sdk\tools

    ifneq ($(ANDROID_JACK_VM_ARGS),)
    jack_vm_args := $(ANDROID_JACK_VM_ARGS)
    else
    jack_vm_args := -Dfile.encoding=UTF-8 -XX:+TieredCompilation
    endif
    .....
    ifneq ($(dist_goal),)
        $(hide) mkdir -p "$(DIST_DIR)/logs/jack/"
        $(hide) JACK_SERVER_VM_ARGUMENTS="$(jack_vm_args) -Dcom.android.jack.server.log.file=$(abspath $(DIST_DIR))/logs/jack/jack-server-%u-%g.log" $(PRIVATE_JACK_ADMIN) start-server 2>&1 || exit 0
    else
        $(hide) JACK_SERVER_VM_ARGUMENTS="$(jack_vm_args)" $(PRIVATE_JACK_ADMIN) start-server 2>&1 || exit 0
    endif
    

    So we can export

    ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
    

    to config jack args. And then run this below:

    ./prebuilts/sdk/tools/jack-admin kill-server
    ./prebuilts/sdk/tools/jack-admin start-server
    
    0 讨论(0)
  • 2020-12-02 13:27

    goto build/core/config.mk and change heap size in

    APICHECK_COMMAND := $(APICHECK) -JXmx8g -J"classpath $(APICHECK_CLASSPATH)"

    then it will work fine.
    Other solutions didn't help me.

    0 讨论(0)
提交回复
热议问题