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

错误如下:

[100% 2/2] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
[ 50% 1/2] glob art
[  0% 1/55542] 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 "/root/.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'
[  0% 6/55542] target  C++: libv8src <= external/v8/src/regexp/jsregexp.cc
ninja: build stopped: subcommand failed.
11:13:44 ninja failed with: exit status 1

#### failed to build some targets (03:46 (mm:ss)) ####

在 LINUX/android 目录下执行如下命令,发现:OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8077 仍然是ssl错误,意思是client给服务端发送了TLSv1.3加密方式的hello握手请求,直接就报错了。

❯ JACK_EXTRA_CURL_OPTIONS=-v ./prebuilts/sdk/tools/jack-admin list server

*   Trying 127.0.0.1...
*   TCP_NODELAY set
*   Connected to localhost (127.0.0.1) port 8077 (#0)
*   ALPN, offering http/1.1
*   Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
*   successfully set certificate verify locations:
*   CAfile: /root/.jack-server/server.pem
    CApath: none
    } [5 bytes data]
*   TLSv1.3 (OUT), TLS handshake, Client hello (1):
    } [512 bytes data]
*   OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8077 
*   Closing connection 0
    SSL error when connecting to the Jack server. Try 'jack-diagnose'

也可通过如下命令得出错误log。

./prebuilts/sdk/tools/jack-admin dump-report

可能会看到如下的错误,意思是没有合适的协议,协议被禁用或密码套件不对称。

javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

解决如下,解除jdk中的ssl3禁用算法,去掉SSLv3,这样便支持了TLSv1.3,再编译即可。

nano /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/security/java.security //jdk路径
//或代码中的jdk文件:LINUX/android/prebuilts/jdk/jdk8/linux-x86/jre/lib/security/java.security
#jdk.tls.disabledAlgorithms=SSLv3,TLSv1,TLSv1.1, RC4, MD5withRSA, DH keySize < 768, \
    EC keySize < 224 
jdk.tls.disabledAlgorithms=TLSv1,TLSv1.1, RC4, MD5withRSA, DH keySize < 768, \
EC keySize < 224 //去掉SSLv3修改后

你可能感兴趣的:(SSL error when connecting to the Jack server. Try 'jack-diagnose')