flutter

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

If you are getting the above error while building your Flutter project then you can the below commands to remove the error.

// Run below commands to update JDK version on your mac

brew tap homebrew/cask-versions

brew install --cask zulu11

The Android Gradle plugin requires Java 11 or higher to run, so you will need to update your Java version to resolve this issue. Here are the steps you can follow:

The commands will update the JDK version on your system and the gradle error will be solved.

brew tap homebrew/cask-versions
brew install --cask zulu11

This will install the Zulu 11 Java Development Kit (JDK) using Homebrew on a macOS system.

  1. The first command brew tap homebrew/cask-versions adds the homebrew/cask-versions repository to the list of available repositories that Homebrew can access. This repository provides access to older and newer versions of software that can be installed via Homebrew.
  2. The second command brew install --cask zulu11 installs the Zulu 11 JDK via Homebrew. The --cask option specifies that Zulu 11 should be installed as a macOS application bundle. Zulu is an open-source, certified build of OpenJDK that is maintained by Azul Systems. By default, it will install the latest version of Zulu 11 available in the Homebrew repository.

After running these commands, you should have the Zulu 11 JDK installed on your system. You can verify this by running java -version in the terminal, which should output information about the installed version of Java.

Was this helpful?