SSL error when connecting to the Jack server. Try ‘jack-diagnose’

Linux编译APP时报如下错误:
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/xxx/.jack-server”
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/xxx/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
Jack server failed to (re)start, 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’
ninja: build stopped: subcommand failed.
19:29:44 ninja failed with: exit status 1

failed to build some targets (11:13 (mm:ss))

如下图:

SSL error when connecting to the Jack server.jpg

分析错误可知,有以下错误:
FAILED: setup-jack-server
Jack server failed to (re)start, try ‘jack-diagnose’ or see Jack server log
SSL error when connecting to the Jack server. Try ‘jack-diagnose’

根据提示运行jack-diagnose,输出如下信息:

Port 8077 is used by another process (pid=), please ensure to free the port or change port configuration in ‘/home/xxx/.jack-settings’ and ‘/home/xxx/.jack-server/config.properties’
error: process ID list syntax error

发现是端口被占用了。需要修改.jack-settings和config.properties。这两个文件位置如下:

/home/用户名/.jack-settings
/home/用户名/.jack-server/config.properties

修改步骤如下:

1、将 .jack-settings 文件里的端口号改为:
SERVER_PORT_SERVICE=8386
SERVER_PORT_ADMIN=8387

2、将 config.properties 文件里的端口号改为:
jack.server.service.port=8386
jack.server.admin.port=8387

3、然后在项目根目录下运行终端命令:cd /LINUX/android/prebuilts/sdk/tools

4、然后分别执行终端命令 ./jack-admin kill-server 和 ./jack-admin start-server 启动Jack server

5、最后重新编译。

到第5步,一般会成功。如果失败,继续查看第6步。

6、修改 java.security 文件。java.security 位置如下图:

java.security位置.jpg

其属性信息如下:

java.security属性信息.jpg

7、在上述位置打开终端命令窗口,运行 sudo chmod 777 java.security 命令改变文件的权限。否则我们的修改不会起作用。当然,也可以直接运行 cd /etc/java-8-openjdk/security 命令到上述位置。

8、然后执行 sudo vim java.security 命令打开 java.security 文件,出现如下界面:

查看java.security文件.jpg

找到如上所示的文件位置,按 i 键进行修改,大概在704行,删除掉 TLSv1, TLSv1.1 ,然后按 esc键,切换模式,再按 wq 键保存并退出。最后重复上述步骤 3、4、5 即可。如果还是编译失败,可以查看文章Linux编译APP时报FAILED: setup-jack-server

发表回复

后才能评论