-2

this is really makes me frustated, i searched for the solution for this but i nothing is working. if check on terminal my java version, it's version 16 but when i try to run flutter in android emulator it read java 1.8. Im running on macOs Monterey and with msvcode

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`.
CCP
  • 886
  • 1
  • 10
  • 30
  • How do you run the gradle build? If you launch it from your IDE then that probably has its own settings telling it which JDK to use. – Joachim Sauer Sep 15 '22 at 09:39
  • You can find refer this link : https://stackoverflow.com/questions/66980512/android-studio-error-android-gradle-plugin-requires-java-11-to-run-you-are-cur – Hardik Mehta Sep 15 '22 at 09:47

2 Answers2

0

1.In Android Studio, navigate to File -> Project Structure or press Ctrl+Alt+Shift+S to open project structure.
2.In Platform Settings -> SDKS -> Android API -> Java SDK (Now choose JDK as per your requirement).

-1

i think you have to upgrade your JDK version and make it 1.8 to11

enter image description here

sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
MohitJadav86
  • 782
  • 3
  • 11