Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8, but i'm using java 11
Solution 1
Is your place set up?
Is the gradle java version too low
JAVA_HOME D:\Android\Android Studio\jre
%JAVA_HOME%\bin
Solution 2
I got the same problem but what I did is that I deleted the android folder and run it again. If your are using android studio, in your terminal past this Flutter create . and it will build the android project using your specified SDK instead
Solution 3
The headache-less solution:
Just uninstall your (older) version of android studio, go to their website, and install the latest version. This should automatically update your java version to whatever your Flutter project requires.
Worked for me after trying lots of other methods.
Admin
Updated on January 04, 2023Comments
-
Admin over 1 year
I imported a Flutter project, and when I tried to run it, I got this message error:
FAILURE: Build failed with an exception. * Where: Build file '/home/omer358/FlutterProjects/MyProjects/ConverterNOW/android/app/build.gradle' line: 24 * 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`. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 22s Exception: Gradle task assembleDebug failed with exit code 1
I searched for some solutions, one of them suggested that I'm using java1.8 but that was not the case!
omer358@OMO:~/FlutterProjects/MyProjects/ConverterNOW/android$ ./gradlew --version ------------------------------------------------------------ Gradle 7.0.2 ------------------------------------------------------------ Build time: 2021-05-14 12:02:31 UTC Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e Kotlin: 1.4.31 Groovy: 3.0.7 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 11.0.14 (Ubuntu 11.0.14+9-Ubuntu-0ubuntu2.22.10) OS: Linux 5.13.0-35-generic amd64
can you help me make go away!
-
Néstor about 2 yearsHave you checked you Android Studio settings?
-
Omer Maki about 2 yearsI"m using vs code
-
Néstor about 2 yearsYou may have then 2 java version installed and the jre maybe pointed to the version 1.8
-
Omer Maki about 2 yearsI considered that too, I removed java completely from my machine and installed java 11 again, I also set the JAVA_HOME to /usr/bin/java
-