Jack-Server(二) aosp 编译过程中Jack server SSL error 错误解决方法
一.jack-server 配置
1.1.Android7.1 系统使用 jack-server 作为 java 代码编译器,在编译过程中可能会遇到以下类似的错误:
Jack server already installed in "/home/user/.jack-server" Communication error with Jack server (1), try 'jack-diagnose' or see Jack server log Communication error with Jack server 1. Try 'jack-diagnose' Communication error with Jack server 1. Try 'jack-diagnose'
此错误是由于 jack-server 本身编译器限制,同一个网络端口号不能多个用户同 时使用
即多个用户在同一个服务器上协同开发过程中,编译 Android7.1 时,需要 配置各自使用不同的网络端口号
1.2.jack-server 的两个配置文件(user 为对应用户的用户名),决定了它所使用的端口号
/home/user/.jack-server/config.properties /home/user/.jack-settings
这两个配置文件需要配置两个端口号,分别为服务端端口号,及客户端端口号, 两个配置文件中的端口号要匹配
jack.server.service.port=8074 jack.server.admin.port=8075 及 SERVER_PORT_SERVICE=8074 SERVER_PORT_ADMIN=8075
配置步骤如下: 确保两个配置文件存在,并且权限设置为 0600
chmod 0600 /home/user/.jack-server/config.properties chmod 0600 /home/user/.jack-settings
1.3. 文件 .jack-settings 文件目录 .jack-server
![](https://img2022.cnblogs.com/blog/2041208/202203/2041208-20220325111152023-1651230922.png)
1.4. .jack-server/config.properties
修改端口号,请更改 service port 及 admin port 为其他端口号,两个配置文件 里的端口号需要匹配 示例如下:
jack.server.service.port=8090 jack.server.admin.port=8091 及 SERVER_PORT_SERVICE=8090 SERVER_PORT_ADMIN=8091
若两个配置文件不存在 请参照以下文本新建这两个配置文件 config.properties 文件示例如下(端口号需按实际修改)
.jack-settings
# Server settings SERVER_HOST=127.0.0.1 SERVER_PORT_SERVICE=8090 SERVER_PORT_ADMIN=8091 # Internal, do not touch SETTING_VERSION=4
.jack-server/config.properties
jack.server.max-jars-size=104857600 jack.server.max-service=4 jack.server.service.port=8090 jack.server.max-service.by-mem=1\=2147483648\:2\=3221225472\:3\=4294967296 jack.server.admin.port=8091 jack.server.config.version=2 jack.server.time-out=7200
1.5. prebuilts/sdk/tools 重启 jack-server ./jack-admin kill-server && ./jack-admin start-server
二 .Android 7.1 编译过程中Jack server SSL error 错误解决方法
2.1.使用的环境是ubuntu 16.04 编译大概率会出现jack server 跑不起来然后抛一个类似这样的错误
![](https://img2022.cnblogs.com/blog/2041208/202203/2041208-20220325104106151-2034615314.png)
如下:
[ 10% 538/4980] Ensuring Jack server is installed and started FAILED: setup-jack-server /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack- launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack- admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack- 4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )" Jack server already installed in "/home/user/.jack-server" Communication error with Jack server (35), try 'jack-diagnose' or see Jack server log SSL error when connecting to the Jack server. Try 'jack-diagnose' SSL error when connecting to the Jack server. Try 'jack-diagnose' [ 10% 541/4980] build out/target/product/rk3399_mid/obj/ETC/precompiled_sepolicy_intermediates/precompiled_sepoli cy ninja: build stopped: subcommand failed. 22:32:18 ninja failed with: exit status 1 build completed failed
2.2.原因就是编译时用的是open-jdk 8u292,默认禁用了TLSv1, TLSv1.1, 从/etc/java-8-openjdk/security/java.security中取消TLSv1, TLSv1.1 禁用, 修改前:
![](https://img2022.cnblogs.com/blog/2041208/202203/2041208-20220325104815701-371086141.png)
修改后:
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, \ DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \ include jdk.disabled.namedCurves
2.3./prebuilts/sdk/tools/ 目录下执行 ./jack-admin kill-server && ./jack-admin start-server 成功