0

I did a fresh install of the Android Studio Flamingo and tried to run a flutter code project but encounter this error code.

Failed to apply plugin 'com.android.internal.application'.

Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.

I tried the solutions posted on stackoverflow but my Android Studio does not have the Gradle JDK selection option

Can anyone help?

  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community May 22 '23 at 08:57

1 Answers1

2

I faced a slightly different problem, but I think the resolution could be the same.

The error I had was "class file major version 61", and after reading this, I understood I needed my project to compile with Java 11, and I think that will resolve your issue as well.

Steps to fix:

  1. Download java11 - brew install openjdk@11
  2. Symlink it to your JVM folder - In the output of the above command, find "For the system Java wrappers to find this JDK, symlink it with " - run this command
  3. In android/gradle.properties, add line org.gradle.java.home=/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home

The good thing here is that you aren't changing your java home value or anything so if you need java 1.8 for other projects that's fine, you're just telling this project to compile with 11

Cantor1616
  • 21
  • 2