Full Error —
An exception occurred applying plugin request [id: ‘com.android.application’]
Failed to apply plugin ‘com.android.internal.application’.
Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
Your current JDK is located in C:Program FilesJavajdk-11.0.13
You can try some of the following options:
– changing the IDE settings.
– changing the JAVA_HOME environment variable.
– changingorg.gradle.java.home
ingradle.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.
Just Created the new project and getting this error
2
Answers
Step 1: Just Download the Java 17. LINK
Step 2: Set environment variable for Java 17.
Step 3: In Android Studio Go to File → settings → Build, Execution, Deployment → Build Tools → Gradle → Gradle JDK And Select Java 17.
Step 4: Delete the Gradle Cache directory if you still get the error, on Mac it's located at
~/.gradle/caches
BUILD SUCCESSFUL :)
In my case I downloaded gradle JDK version corretto-17 Amazon, and changed Gradle JDK version to corretto and it worked.
Not worked others(ex: jbr-17, embedded JDK Jetbrains 17 and etc.)