Skip to content

Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.

Snoy-Kuo edited this page Mar 29, 2022 · 2 revisions

Messages

Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options:

  • changing the IDE settings.
  • changing the JAVA_HOME environment variable.
  • changing org.gradle.java.home in gradle.properties.

Description

I cannot build the Android Studio project with above message on Jenkins.

Dev env

  • macOS 11.6 (Big Sur) x64
  • Android Studio Bumblebee Patch 1
  • Android SDK version 31
  • Android Gradle Plugin: 4.1.3
  • Gradle: 7.1.1
  • Gradle JDK: corretto-1.8
  • Kotlin: 1.6.10
  • Jenkins 2.190.2

Tried approaches

Solutions

  • The DevOps helped me install JDK 11 in the node where Build Job runs. Then I update the JAVA_HOME env var temporarily in my building script. This works for me.
    • If you use a Freestyle Job, you can add export JAVA_HOME=your_jdk11_path in the building script.
    • If you use a Declarative Pipeline Job, you can add JAVA_HOME='your_jdk11_path' in the environment section.