In order to run the Android jack build server multiple times on one host, one has to modfiy jack’s ports in the config.

$HOME/.jack file

The $HOME/.jack (Older versions: $HOME/.jack-settings) file contains the following settings for Jack server variables in a full bash syntax (Symlink one file to the other):

SERVER=true. Enable the server feature of Jack.
SERVER_PORT_SERVICE=8177. Set the TCP port number of the server for compilation purposes.
SERVER_PORT_ADMIN=8178. Set the TCP port number of the server for admin purposes.
SERVER_COUNT=1. Unused.
SERVER_NB_COMPILE=4. Set the maximum number of allowed parallel compilations.
SERVER_TIMEOUT=60. Set the number of idle seconds the server must wait without any compilation before shutting itself down.
SERVER_LOG=${SERVER_LOG:=$SERVER_DIR/jack-$SERVER_PORT_SERVICE.log}. Set the file where server logs are written. By default, this variable can be overloaded by an environment variable.
JACK_VM_COMMAND=${JACK_VM_COMMAND:=java}. Set the default command used to launch a JVM on the host. By default, this variable can be overloaded by environment variable.


~/.jack-server/config.properties

There’s also ~/.jack-server/config.properties which should have the same ports as the .jack .jack-settings file:


jack.server.max-jars-size=104857600
jack.server.max-service=4
jack.server.service.port=8177
jack.server.max-service.by-mem=1\=2147483648\:2\=3221225472\:3\=4294967296
jack.server.admin.port=8178
jack.server.config.version=2
jack.server.time-out=7200

You need to modify all/both files,because I modified SERVER_PORT_SERVICE and SERVER_PORT_ADMIN (default 8076/8077) in .jack and nothing happend. ~/.jack-server/config.properties stayed always on the default: 8076,8077.

Also comment out comment out the line with uninstall-server in <AOSP>/prebuilts/sdk/tools/jack_server_setup.mk

Source: https://groups.google.com/forum/#!topic/android-building/UWhJrXH8Vig