Failed in Android compilation: solution to setup Jack server problem

        The following error occurred when compiling Android:

[ 28% 1127/3932] Ensuring Jack server is installed and started
FAILED: setup-jack-server

Picture:

 

Reason: when Jack compiles, there may be multiple people compiling at the same time. At this time, there may be two people using the same port, resulting in port conflict and timeout.

Solution: modify the port number (modify the. Jack settings and. Jack server/config. Properties files)  

Step 1:

        Open the. Jack settings file in the root directory of the project, and modify Jack. Server. Service. Port and   Jack.server.admin.port port. Set the port number as large as possible to reduce the probability of port collision. For example, I set jack.server.service.port to 28078 and jack.server.admin.port to 28079

# Server settings
SERVER_HOST=localhost
SERVER_PORT_SERVICE=28078
SERVER_PORT_ADMIN=28079

# Internal, do not touch
SETTING_VERSION=4

  Step 2:

        Open the. Jack-server/config.properties file in the root directory of the project, and set jack.server.service.port and jack.server.admin.port to the same values as the steps.

jack.server.idle=180
jack.server.max-service.by-mem=1\=2147483648\:2\=3221225472\:3\=4294967296
jack.server.shutdown=21600
jack.server.time-out=7200
jack.server.max-jars-size=104857600
jack.server.service.port=28078
jack.server.admin.port=28079
jack.server.config.version=4
jack.server.max-service=4
jack.server.deep-idle=900

  After modification, if there is no conflict, you can compile normally.

Read More: