Flutter application not working due to Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8

Viewed 25

I am trying to make a flutter application but I constantly get this error :

* What went wrong:
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.
       - changing `org.gradle.java.home` in `gradle.properties`

I followed this question : Android Studio Error "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8"

and this was the output :

------------------------------------------------------------
Gradle 7.4
------------------------------------------------------------

Build time:   2022-02-08 09:58:38 UTC
Revision:     f0d9291c04b90b59445041eaa75b2ee744162586

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          13.0.7 (Private Build 13.0.7+5-Ubuntu-0ubuntu120.04)
OS:           Linux 5.4.0-125-generic amd64

JVM points to 13.0.7. What can be issue and how can it be resolved? Thankyou

1 Answers

In your Android Studio IDE, go to ~

Preferences → Build, Execution, Deployment → Build Tools → Gradle → *Gradle JDK enter image description here and choose the appropriate JDK version and apply. Try to take the embedded JDK as that would be IDE version appropriate. After this sync project and run.

Related