代码改变世界

[Jenkins] 解决 Gradle 编译包含 SVG Drawable 出现异常

2017-11-10 13:52  shaobin0604  阅读(531)  评论(0编辑  收藏  举报

异常信息

java.awt.AWTError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.

解决方案

在 Jenkins shell 脚本里调用 gradlew 编译之前,增加如下语句

unset DISPLAY

其他说明

在 gradle 中使用 AWT 绘图功能出现的类似错误也可以用这个办法解决

参考