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
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 withSERVER_PORT_SERVICE=XXXX
in$HOME/.jack-settings
andjack.server.service.port=XXXX
in$HOME/.jack-server/config.properties
.
Step 2
SERVER_PORT_ADMIN=YYYY
Replace withSERVER_PORT_ADMIN=YYYY
in$HOME/.jack-settings
andjack.server.admin.port=YYYY
in$HOME/.jack-server/config.properties
.
Step 3
SERVER_NB_COMPILE=N
Replace withjack.server.max-service=N
in$HOME/.jack-server/config.properties
.
Extra Settings
SERVER_TIMEOUT=ZZ
You can replace withjack.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
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
Just try add
export ANDROID_JACK_VM_ARGS="-Xmx8192m -Xms512m -Dfile.encoding=UTF-8 -XX:+TieredCompilation"
to the end of .bashrc and reboot Linux
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
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.