9

How can I set the new path for Java JDK? I tried to change the environment variables but it did not work.

IDE: Android Studio Arctic Fox | 2020.3.1 Beta 4

IDE: Android Studio Bumblebee | 2021.1.1

Aliaksei
  • 3,542
  • 1
  • 16
  • 21

2 Answers2

13
  1. Go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
  2. Choose JDK folder for Gradle JDK field
  3. Apply changes

enter image description here

NB: If you haven't Java environment on your PC, go to https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html and download Java jdk for your platform.

NB2: It's JDK for your Gradle, not for your source code compiler (!)

Aliaksei
  • 3,542
  • 1
  • 16
  • 21
  • 1
    This is the Gradle JDK, not the JDK used by the IDE – OneCricketeer Aug 06 '21 at 08:49
  • @Aliaksei Kisel In my Arctic Fox I don't have this option, any solution? https://stackoverflow.com/questions/69704289/android-studio-arctic-fox-gradle-procject-settings-not-exists – babayaro Oct 25 '21 at 08:16
  • @babayaro It seems that Gradle wasn't configured for your project. See `Project structure` – Aliaksei Oct 25 '21 at 10:04
  • 1
    It's always amazing how difficult to find this in the menu, I always need to rely on Stackoverflow to locate it. – Morgan Koh Jan 18 '23 at 08:48
  • For latest Android Studio (eg: Android Studio Flamingo | 2022.2.1), the `Settings` option can be found by going to `Android Studio` > `Settings` – Aishwarya May 12 '23 at 13:48
1

Android Studio Bumblebee | 2021.1.1 Patch 1 has a fix for "Env variables not sourced when launched from Mac OS X to Monterey Dock" - See https://androidstudio.googleblog.com/2022/02/android-studio-bumblebee-202111-patch-1.html

Klemens Zleptnig
  • 1,698
  • 20
  • 36