When we tried to compile one of our android application using Android Studio, we got the following error,
A problem occurred evaluating project ‘:app’.
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.
– changingorg.gradle.java.home
ingradle.properties
.
Solution :
This error can be solved by configuring Android Studio to use Java 11 as your studio is currently set to us Java 1.8. Please follow below steps to change the Java version,
Now, click on “1.8” in front of “Gradle JDK” (4) and select version 11 as shown in below image,
That’s it.. now if you try to compile, you should not see the error.