The gradle build is trying to find the java jdk 8 at this location: C:Program FilesJavajdk1.8.0_101binjava.exe
.
This fails because I uninstalled java 8 and want to use java 11 instead.
I have no idea where it is getting this value from.
I set a system environment variable for JAVA_HOME to C:Program FilesJavajdk-11.0.12bin
.
I also have specified the gradle JDK in the settings > Build, Execution Deployment > Build Tools > Gradle configurations to 11 (C:Program FilesJavajdk-11.0.12)
.
Also in the gradle.properties file (C:Usersuser nameStudioProjectsgradle.properties) I set org.gradle.java.home=C:\Program Files\Java\jdk-11.0.12
.
Even after restarting (for the environment variable) gradle is still trying to use the java 8 JDK.
How can I get gradle to use the correct JDK?
3
Answers
Solved by invalidating the caches and restarting (apparently this setting was cached):
File > Invalidate Caches / Restart
It happened to me when upgrading to Android Studio Electric Eel | 2022.1.1
Just delete "jre" folder in Android Studio installed directory. And restart Android Studio.
thank you,this problem solved;