How do I remove an accidentally added duplicate Gradle version from Android Studio?

Issue

I wanted to use OpenJDK 11 and accordingly, I have provided the path in Android Studio by going to Settings -> Gradle -> Gradle JDK. Later, while just trying to test the outcome of adding the same JDK, I saw it got added and the same name was suffixed with (2) in the list. I am sharing the image to provide more clarity.

Now, how can I remove the listed duplicate entry? Thanks.

enter image description here

Solution

What I understood is that you want to remove 11(2) from jdk list
first you need to locate android studio settings directory
for windows:
C:\Users\username\AppData\Roaming\Google\AndroidStudioX.Y\options
for linux:
/home/username/.config/Google/AndroidStudioX.Y
and
/home/username/.local/share/Google/AndroidStudioX.Y
for mac:
~/Library/Application Support/Google/AndroidStudioX.Y

second search for file jdk.table.xml
after that search for your jdk with name 11 (2)
if you found it, remove JDK input and save file
tag to be removed looks like below

<jdk version="2">
  <name value="14 (2)" />
  <type value="JavaSDK" />
  <version value="version 14.0.1" />
  <homePath value="C:/Program Files/Java/jdk-14.0.1" />
  ...
</jdk>

I have tried it with android studio opened and settings weren’t applied until I restarted it so It’s prefered you do it with android studio closed.
also I applied it on windows operating system

Answered By – Islam Assem

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published