Error message “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:

> 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 already downloaded Java 11 and added Java 11 in gradle.properties.

Solution:

Make sure that your Gradle is using the proper JDK. Try running ./gradlew --version in your project’s directory. The output should be something like this:

Gradle 7.0-rc-2
------------------------------------------------------------

Build time:   2021-04-01 21:26:39 UTC
Revision:     912a3368b654b71250dfc925a20d620393

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.10 (Ubuntu 11.0.10+9-Ubuntu-0ubuntu1.20.10)
OS:           Linux 5.11.4-051104-generic amd64

If the JVM points to version 1.8 then you should change it in settings. You can find it in Preferences → Build, Execution, Deployment → Build Tools → Gradle → *Gradle JDK.

Enter image description here

For Android Studio Arctic Fox (4.2), with 2020.3.1 Patch 2 on Windows 10 Pro PC:

Step 1

Enter image description here

Step 2

Enter image description here
We will be happy to hear your thoughts

Leave a reply

CodeROG
Logo
Compare items
  • Total (0)
Compare
0