The Error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. “, is an error that is invoked when you are working on android studio. Given below is the snippet of the error you might get:
> 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`.
I would like to share with you the steps I took to fix the “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.” error.
Why “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. ” Error is Seen?
The error, “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. ” is seen because your grade version is not using the proper JDK version. Run the following code ./gradlew --version
and check your JVM version to know if this is the problem.
The error is also caused if you are using an outdated version of android studio, so you should upgrade your android studio (version 4.1).
The detailed solution to fix the error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. “, is given below:
How to fix the error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. “?
To fix the error, you will have to make sure that your grade version is using the proper jdk also you will have to make sure that you are using the updated version of android studio (version 4.1 or later) as of now.
To fix the error, “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. “, you will have to follow the below mentioned steps:
First you will have to make sure that Gradle is using the proper JDK version in your project. Run the following code ./gradlew --version
in your project’s directory, and check your JVM version.
In case your JVM says version 1.8 then you will have to change it in settings. You will be able to find it in Preferences -> Build, Execution, Deployment ->Build Tools -> Gradle -> *Gradle JDK. Look at the below mentioned image for you reference:
If the above method does not fix the error it is most likely that you are using an outdated version of android studio. So try updating your android studio to fix the error.
This should fix the error, “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. “
Conclusion
To fix the error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. “, you will have to make sure that your grade version is using the proper jdk.
You will also have to make sure that you are using the updated version of android studio (version 4.1 or later).