javaandroidwindowsandroid-studiokotlin

How to change JDK location in Android Studio?


When I open my project in Android Studio I see default JDK https://i.sstatic.net/XP8HN.png

I went to settings and tried to change jdk but it didn't save. The previos path is still showed in Android Studio enter image description here

I saw other threads, one of my path doesn't contains s whitespace.

Should I change something in my gradle.kts file?


Solution

  • java -version
    

    Would help us to know to the current java version. To switch between the installed java versions, update-java-alternatives would help.

    To list all java versions installed in the device

    update-java-alternatives --list
    

    To set a java version as default,

    sudo update-java-alternatives --set <path_to_installed_java_version>