Debug School

rakesh kumar
rakesh kumar

Posted on

Flutter Error:You need Java 11 or higher to build your app

You need Java 11 or higher to build your app
you-need-java-11-or-higher-to-build-your-app-with-this-version-of-gradle

Error:You need Java 11 or higher to build your app with this version of Gradle?

Was building app using flutter and vs code ,I had not installed android studio can i know how to upgrade Java version OpenJDK Runtime Environment.

My java version

C:\Android\cmdline-tools\tools>java -version
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
Enter fullscreen mode Exit fullscreen mode

Version displaying in flutter doctor -v

• Android SDK at C:\Android\
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = C:\Android
• Java binary at: C:\Android\openjdk\bin\java
Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_202-b08)
• All Android licenses accepted.

FAILURE: Build failed with an exception.

  • Where:
Build file 'C:\flutter-firebase\holidaylandmark\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`.
Enter fullscreen mode Exit fullscreen mode

Solution

Image description
Before changes
Image description

Image description

Top comments (0)