Android JACK 编译错误SSL error when connecting to the Jack server

背景

之前编译好好,今天居然遇到了这样子的问题。还以为是和之前一样,Android7.0 配置JACK支持多用户同时编译

结果不是:

/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/xx/.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‘

修复

修改 prebuilts/sdk/tools/jack-admin即可。

diff --git a/prebuilts/sdk/tools/jack-admin b/prebuilts/sdk/tools/jack-admin
index ee193fcf5a..2ac3c29685 100755
--- a/prebuilts/sdk/tools/jack-admin
+++ b/prebuilts/sdk/tools/jack-admin
@@ -26,7 +26,7 @@ umask 077
 JACK_HOME="${JACK_HOME:=$HOME/.jack-server}"
 CLIENT_SETTING="${CLIENT_SETTING:=$HOME/.jack-settings}"
 TMPDIR=${TMPDIR:=/tmp}
-JACK_SERVER_VM_ARGUMENTS="${JACK_SERVER_VM_ARGUMENTS:=-Dfile.encoding=UTF-8 -XX:+TieredCompilation}"
+JACK_SERVER_VM_ARGUMENTS="${JACK_SERVER_VM_ARGUMENTS:=-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xm4g }"
 JACK_EXTRA_CURL_OPTIONS=${JACK_EXTRA_CURL_OPTIONS:=}

 LAUNCHER_JAR="$JACK_HOME/launcher.jar"
@@ -57,8 +57,8 @@ if [[ ! -f "$CLIENT_SETTING" || $SETTING_VERSION -lt 4 ]]; then
   cat >"$CLIENT_SETTING.$$" <<-EOT
        # Server settings
        SERVER_HOST=${SERVER_HOST:=127.0.0.1}
-       SERVER_PORT_SERVICE=${SERVER_PORT_SERVICE:=8076}
-       SERVER_PORT_ADMIN=${SERVER_PORT_ADMIN:=8077}
+       SERVER_PORT_SERVICE=${SERVER_PORT_SERVICE:=8176}
+       SERVER_PORT_ADMIN=${SERVER_PORT_ADMIN:=8177}

        # Internal, do not touch
        SETTING_VERSION=4
@@ -451,7 +451,7 @@ case $COMMAND in
     if [ "$RUNNING" = 0 ]; then
       echo "Server is already running"
     else
-      JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"
+      JACK_SERVER_COMMAND="/usr/lib/jvm/java-7-openjdk-amd64/bin/java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4g -cp $LAUNCHER_JAR $L
AUNCHER_NAME"
       echo "Launching Jack server" $JACK_SERVER_COMMAND
       (
         trap "" SIGHUP

附录:报错原因

最近也有人提这个问题,而且说得很详细:就是JDK 版本的问题引起的。

ref : https://groups.google.com/g/android-building/c/hsGPbjjjxeE/m/LO0h0PvcAgAJ

Android JACK 编译错误SSL error when connecting to the Jack server

Android JACK 编译错误SSL error when connecting to the Jack server

上一篇:vue CLI或uniapp项目使用腾讯地图获取当前位置经纬度


下一篇:前端扯犊子之一Axios