提问者:小点点

将Java版本从8升级到11以使用Jenkins构建apk


我们使用Jenkins作业来构建apks。为了将gradle升级到7.2版,需要将Java升级到11版。

在jenkins服务器上安装java11的openjdk后,某些模块的jenkins作业失败,并出现以下错误:

Execution failed for task ':common:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':common:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /opt/android/platforms/android-30/core-for-system-modules.jar.
         > jlink executable /usr/lib/jvm/java-11-openjdk-amd64/bin/jlink does not exist.

知道怎么解决吗?


共1个答案

匿名用户

/usr/lib/jvm/java-11-openjdk-amd64/bin/中确实缺少jlink

重新安装openjdk11修复了这个问题:

  • sudo apt自动删除openjdk-11-jdk-Headless
  • sudo apt安装openjdk-11-jdk-Headless