Whenever I open an existing Android project in Android Studio for the first time, Android Studio sets the Gradle JDK to GRADLE_LOCAL_JAVA_HOME which points to the Android Studio's built-in JDK. I would like GRADLE_LOCAL_JAVA_HOME to point to a different JDK location (the same that I use in my JAVA_HOME and the one I have in PATH) but I can't figure out how to do it.
It's annoying that whenever I open a project I get a wrong JDK by default and I must open the settings and choose the one under JAVA_HOME manually. I would like Android Studio to pick up my custom default automatically instead.

This documentation says that:
GRADLE_LOCAL_JAVA_HOME: uses thejava.homeproperty in the.gradle/config.propertiesfile which defaults to the JetBrains Runtime.
I hoped that I could change it globally somewhere and tried creating $HOME/.gradle/config.properties and putting java.home there but it doesn't work. Does it mean Android Studio respects only the config.properties file in the project's .gradle directory?
you can override your Default JDK from File > New Project Setup > Setting for new project > Build, Execution, Deployment > Build Tools > Gradle and chagne the Default Gradle JDK.
FYI: https://issuetracker.google.com/issues/214428183#comment10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With