Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
How can I change the version of Java used by the project? Download the corresponding version. I run the project from Visual Studio Code.
Add this code in "my-project/android/gradle.properties"
org.gradle.java.home=C:\Program Files\Java\jdk-11.0.14
But I get the following error:
Value 'C:Program FilesJavajdk-11.0.14' given for org.gradle.java.home Gradle property is invalid (Java home supplied is invalid)
CodePudding user response:
there!
I was facing the same issue.
Just make sure you have your JAVA_HOME into yours enviroments variables, mine has the next path -> enter image description here
CodePudding user response:
You can modify the JDK version to compile your projects like this:
"java.configuration.runtimes": [
{
"name": "JavaSE-17",
"path": "C:\\Users\\Administrator\\Desktop\\jdk-17.0.2",
"default": true
},
{
"name": "JavaSE-14",
"path": "C:\\Users\\Administrator\\Desktop\\jdk-14"
}
],
You can refer to the official docs for more details.