57

While updating Android Studio I got the following error. The patch was downloaded and extracted, but there was some conflict with jre/bin/java Access denied. The error message is shown in the below screenshot.

The Error message is as shown in the linked image:
(Click image to enlarge)

6
  • I think you download the patch using private network, try to change public network and downloaded it again so that the server can trust your id. Oct 24, 2018 at 9:58
  • I have this issue too. I installed Android Studio under /opt/android-studio chowned as root. When I update I run sudo su and then /opt/android-studio/bin/studio.sh.
    – dcow
    Nov 3, 2018 at 19:20
  • Anyone find a solution to this? I have Android Studio installed in my home folder and I still got this error. Apr 22, 2019 at 16:50
  • 1
    It actually worked for me the second time. I'll leave this comment to let people know that Android Studio update process might just be a bit fickle. Apr 22, 2019 at 17:11
  • 1
    @authentictech Same for me. I just closed all programs included Android Studio. Then when started Android Studio and I was prompted again to update, everything worked, no errors. I didn't change any permission or kill any process or restart my system. I'm using ubuntu 18.04. I'll leave this comment for same reason, to let people know that Android Studio update process might just be a bit fickle. Feb 24, 2020 at 20:32

14 Answers 14

63

Kill java for update

ps -A |grep java

output of this command will give the list of java processes running on your system. Note down Process ID (PID) of that process whom you want to kill and run

kill -9 PID

8
  • 1
    Nice, I thought no java was running, but I was using ps -a instead of ps -A. Feb 9, 2019 at 15:44
  • 1
    I use ps aux | grep java, and in between all the java processes someone may have, the only one to be killed to perform this upgrade is the gradle daemon, which is specified by "org.gradle.launcher.daemon.bootstrap.GradleDaemon"
    – Alessio
    May 3, 2019 at 6:28
  • how does this fix anything?? you could just click "Cancel" too, but neither will complete the update. Or am I missing something? Jul 20, 2019 at 10:45
  • 4
    Ah, I see. The steps I took were: (1) close Android Studio (2) kill all java processes with kill -9 (3) run Android Studio with studio and update Jul 20, 2019 at 11:06
  • none of the solutions worked for me on arch linux, the only thing I found that worked was to reinstall Android Studio
    – Will
    Sep 9, 2019 at 8:08
27

What I found worked for me is with Android Studio running (before initiating the update patch download) I did ps -ef|grep jre on the command line and saw there were 2 jre process running, the one for Android Studio and one of which was for the Gradle daemon which was also using the jre shipped inside Android Studio. The Gradle daemon process will have something like this: gradle-5.3.1/lib/gradle-launcher-5.3.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.3.1

towards the end of its command line when you list processes with ps though of course the specific version you have may not be 5.3.1.

Killing the Gradle process and then starting the update download and then restart from inside Android Studio let the update proceed successfully.

4
  • 2
    The only thing that worked for me. I killed the java process (Gradle) before installing the upgrade. Another solution is to hit the update notification as soon as you see it. Doing it so the AS will not have time to instantiate Gradle and the upgrade will be finished successfully. Aug 26, 2019 at 12:58
  • 2
    This worked for me Nov 28, 2019 at 16:38
  • 1
    This answer worked for me, the "Kill java for update" answer did not. This was updating Android Studio 3.1 to 3.5.
    – tonylo
    Jan 9, 2020 at 17:05
  • Finally your method worked for me. This was on Ubuntu 18.04, upgrading Android Studio 3.4 to 4.0.
    – s1d
    Jun 10, 2020 at 12:45
8

Java process can respawn after kill due to gradle build. The easiest way is to close the project (File -> Close project).

Now that you are back in the Select project menu, you are sure that no gradle is running.

Go to configure at the bottom right and update Android Studio.

3
  • Only method that worked for me.
    – Christian
    Mar 5, 2020 at 7:51
  • solution worked. Thanks Mar 31, 2021 at 8:22
  • just simple as this, thank you! May 30, 2022 at 21:22
5

Those answer above does not work for me. I'm about to upgrading to android studio 3.5 and I met this issue.

Kill the java process just make the upgrade terminated and then android studio restarted with the old version.

My work around is remove the old android-studio directory and download a new one from website and place it exactly where the old one is.

Hope it helps someone!

2

I had the same problem when I tried to update Android Studio installed by JetBrains Toolbox app. In this case, the update should be done via Toolbox, not from IDE.

1

Try uninstalling dart and flutter plugins and then reinstalling the dart and flutter plugins it works for me.

2
  • 4
    Can you please write a fuller explanation? Give example commands that a new user could follow to resolve the issue. Oct 27, 2018 at 10:18
  • This is not neccesary to uninstalling dart and flutter plugins, disable these plugins also work.
    – Nikhil
    Aug 30, 2019 at 12:55
1

For me this problem got fixed by following steps:

  1. change the path of java in the current project. (File -> Project Structure-> SDK Location)
  2. Close the current project.
  3. Restarted the machine (since multiple unsuccessful attempts in had done so thought of restarting).

Next time when i launched studio, it did not opened any project (since i had closed in the previous session). Now from Configure options i updated, and it worked successfully.

1

I also got the same problem when updating from android studio 3.5 to 3.6. It was resolved after closing project from file menu and then updating from configure > check for updates.

0

None of the answers above solved the problem for me. What I managed to do is to change the default jdk from the project structure.

Before you update Go to File -> Project Structure-> SDK Location. Then change the location to OpenJDK or Oracle JDK that you should have already installed in your machine. After that, update your android studio and every thing should be alright (Hopefully ... you how Google treats developers ;) )

0

It is very simple problem.

Thing that you will have to do is - go to the java named file in android installation folder (may be in /opt/android_studio/jre/jre/bin/java or [the folder you extracted the android tar file to]/jre/jre/bin/java) and set permission - read and write.

Now you can update again.

2
  • type -p java in terminal will show path to java. Or locate java will show all files with java in name.
    – LeonidMew
    Mar 14, 2019 at 21:25
  • this should work, but it did not for me. Finally i tried the jetbrains toolbox app way and worked Oct 20, 2019 at 12:23
0

I got this to work by closing the current project I had (this happened to be a flutter/dart project) I then made a new project and found a really extremely basic template. I was then able to upgrade. whatever project I had open before was locking up that directory.

0

On GNU/Linux (Debian/KDE in my case) what worked was:

  • Quitting AndroidStudio
  • Ending all java processes in the task manager (KSysGuard in my case)
  • Running sudo chown -R username:username FolderThatHasAndroidStudio in case it doesn't have these permissions set already (it should have)
  • In folder jre/bin/ make the java file not executable (right click > Properties > Permissions > uncheck Is executable)
  • Start AndroidStudio and go to Help > Check for updates > Update now and wait until it's almost finished
  • Once that's the case check Is executable again and click Apply before it finishes the download.
0

On Ubuntu what worked for me was:

  • Close project.
  • Close all other running programs.
  • Re-boot.
  • Restart Android Studio.
  • Update again.

I am guessing that java was being used before so could not be updated. Annoying that all the patch files had to be downloaded again (third attempt).

0

Simply close Android Studio and install Toolbox then update with toolbox.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .