Android源码编译 Jack编译报错:communication error with Jack server 解决方法

Android源码编译 Jack编译报错:communication error with Jack server 解决方法,第1张

Android源码编译 Jack编译报错:communication error with Jack server 解决方法

Android 源码编译时,经常会遇到jack通信失败问题。

[100% 1/1] Ensure Jack server is installed and started
FAILED: /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.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.8.ALPHA.jar 4.8.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-3.36.CANDIDATE.jar 3.36.CANDIDATE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.7.BETA.jar 4.7.BETA || exit 47 )"
Jack server already installed in "/home/songzhihao/.jack-server"
Communication error with Jack server (77), try 'jack-diagnose' or see Jack server log
Failed to contact Jack server: Problem reading /home/songzhihao/.jack-server/server.pem. Try 'jack-diagnose'
Failed to contact Jack server: Problem reading /home/songzhihao/.jack-server/server.pem. Try 'jack-diagnose'
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1


遇到类似的问题,我们首先要去prebuilts/sdk/tools目录下,运行jack-diagnose命令看一下是什么原因,如果是端口号被占用的问题,先不要着急去改jack-server的端口号,首先看一下是什么进程占用了该端口。

netstat -ap | grep port

就可以看到占用这个端口号的进程是哪个了,然后运行

$ kill -9 该进程pid

再次make Android源码即可。

PS:通过netstat查看到占用该端口号的进程是java,怀疑是上一次编译失败退出后,后台启动的java进程并没有退出,一直占用这个这个port导致的,所以kill掉这个java进程就解决了,个人感觉根本原因是因为Android源码编译的异常退出机制,做的不够完善。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/5707463.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存