General

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

I downloaded the newest Android Studio, and I wanted to run the Android Jetpack Compose Project, but when I ran it, I got the error:

Error:

> Failed to apply plugin 'com.android.internal.application'.
> 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`.

Solution

Solved it by adding this to the gradle.properties file, you have to just add this line

org.gradle.java.home=/usr/lib/jvm/java-11-openjdk-amd64

But your Java 11 may be located in a different directory.

Example path for Windows:

C:\\Program Files\\Java\\jdk-17.0.5

RECOMMENDED ARTICLES





Leave a Reply

Your email address will not be published. Required fields are marked *