. Advertisement .
..3..
. Advertisement .
..4..
Java 11 was released earlier this year and if you are using Android Studio 3.2, you may get the error message, “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8”. This can be frustrating for those who are used to writing code. However, there are some solutions to this. Read on.
When Do You Encounter The Error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8”?
When installing the newest version of Android Studio, you may get the following error.
Failed to apply plugin ‘com.android.internal.application’. > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
How To Fix The Error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8”?
Option 1: Set the Gradle JDK to 11
The simplest method to solve the error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8” is setting the Gradle JDK to 11. Let’s follow these steps below to do that.
- If the JVM is set to version 1.8, you must modify it in the settings to fix the problem.
- Preferences is where you’ll find it.
- Then, choose Build, Execution, and Deployment from the drop-down menu.
- Pick the Build Tools option.
- Then, there’s Gradle.
- Gradle JDK should be set to 11.
- Now, your issue has been fixed.
Option 2: Select the JDK version
Another solution to fix your error is selecting the JDK version as following:
- Access the Download Page.
- Download the system’s JDK ZIP file. (Let’s use Windows as an example.)
- It can be extracted to any folder in the PC’s root directory with high authorizations.
- Access and navigate to the Android studio project structure, which can be found at men File* Project structure.
- Also, paste the directory in which the JDK version was unzipped here. As you can see, I currently have JDK 16 installed within this directory.
Option 3: Warrant that the correct JDK is being used by Gradle
You have to warrant that the correct JDK is being used by Gradle. Run./gradlew —version in the project directory to see whether it works. The output is like as the following:
Gradle 7.0-rc-2
------------------------------------------------------------
Build time: 2021-04-01 21:26:39 UTC
Revision: 912a3368b654b71250dfc925a20d620393
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.10 (Ubuntu 11.0.10+9-Ubuntu-0ubuntu1.20.10)
OS: Linux 5.11.4-051104-generic amd64
You should alter it in settings if the JVM still uses version 1.8. It is in Preferences → Build, Execution, Deployment → Build Tools → Gradle → *Gradle JDK.
This method is very simple, right? However, its eficiency is very enormous. It will help you solve your error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8” and make your program run well without any errors. So, what are you waiting without applying it for your problem?
Conclusion
We hope you found our blog post on solving the error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8”. If you have any further queries or concerns about this topic, please leave a comment. Thank you for reading; we are always glad when one of our articles provides useful knowledge on this subject!
Read more
→ How to Allow insecure protocols android Gradle in Android?
Leave a comment