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'
做法1
也可以用降级的做法来实现,这里以使用的OPENJDK为例。
将JDK降级为允许使用的版本,可以在这里下载安装:https://www.openlogic.com/openjdk-downloads
我是将 JDK8_295 降级为 JDK_272即可。
- Java Version : 8
- Operating System : Linux
- Architecture : x86 64-bit
- Java Package : JDK
卸载 当前的JDK:
sudo apt-get purge -y openjdk*
sudo apt-get purge -y icedtea-* openjdk-*
## 检查是否卸载干净
dpkg --list | grep -i jdk
通过deb包安装JDK8:
## 下载链接
wget https://builds.openlogic.com/downloadJDK/openlogic-openjdk/8u272-b10/openlogic-openjdk-8u272-b10-linux-x64-deb.deb
## 安装
sudo dpkg -i openlogic-openjdk-8u272-b10-linux-x64-deb.deb
做法2
修改 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
以及 vi ~/.jack-server/config.properties ~/.jack-settings
,将port改掉。
可以参考:Android7.0 配置JACK支持多用户同时编译
附录:报错原因
最近也有人提这个问题,而且说得很详细:就是JDK 版本的问题引起的。
ref : https://groups.google.com/g/android-building/c/hsGPbjjjxeE/m/LO0h0PvcAgAJ
如果说我的文章对你有用,只不过是我站在巨人的肩膀上再继续努力罢了。
若在页首无特别声明,本篇文章由 Schips 经过整理后发布。
博客地址:https://www.cnblogs.com/schips/
若在页首无特别声明,本篇文章由 Schips 经过整理后发布。
博客地址:https://www.cnblogs.com/schips/