Android Studio update issue with jre/bin/java

25,495

Solution 1

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

Solution 2

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.

Solution 3

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.

Solution 4

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!

Solution 5

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.

Share:
25,495

Related videos on Youtube

Utkarsh
Author by

Utkarsh

Updated on September 18, 2022

Comments

  • Utkarsh
    Utkarsh almost 2 years

    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)

    • abu-ahmed al-khatiri
      abu-ahmed al-khatiri over 5 years
      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.
    • dcow
      dcow over 5 years
      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.
    • authentictech
      authentictech about 5 years
      Anyone find a solution to this? I have Android Studio installed in my home folder and I still got this error.
    • authentictech
      authentictech about 5 years
      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.
    • cesargastonec
      cesargastonec over 4 years
      @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.
    • Admin
      Admin about 3 years
      Install android studio this way... sudo apt-get install snapd. snap install android-studio --classic.
  • Sanam Patel
    Sanam Patel over 5 years
    Can you please write a fuller explanation? Give example commands that a new user could follow to resolve the issue.
  • Marek Lisý
    Marek Lisý over 5 years
    Nice, I thought no java was running, but I was using ps -a instead of ps -A.
  • LeonidMew
    LeonidMew over 5 years
    type -p java in terminal will show path to java. Or locate java will show all files with java in name.
  • Alessio
    Alessio about 5 years
    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"
  • oliversisson
    oliversisson almost 5 years
    how does this fix anything?? you could just click "Cancel" too, but neither will complete the update. Or am I missing something?
  • oliversisson
    oliversisson almost 5 years
    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
  • Alexander Haroldo da Rocha
    Alexander Haroldo da Rocha almost 5 years
    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.
  • Nikhil
    Nikhil almost 5 years
    This is not neccesary to uninstalling dart and flutter plugins, disable these plugins also work.
  • Will
    Will almost 5 years
    none of the solutions worked for me on arch linux, the only thing I found that worked was to reinstall Android Studio
  • Val Martinez
    Val Martinez over 4 years
    this should work, but it did not for me. Finally i tried the jetbrains toolbox app way and worked
  • Aeiman Bakeer
    Aeiman Bakeer over 4 years
    This worked for me
  • tonylo
    tonylo over 4 years
    This answer worked for me, the "Kill java for update" answer did not. This was updating Android Studio 3.1 to 3.5.
  • Christian
    Christian over 4 years
    Only method that worked for me.
  • kodu
    kodu over 4 years
    This worked, I wish I understood why ... Make sure to close android-studio beforehand!
  • 林果皞
    林果皞 over 4 years
    In my case: Close Project in Android Studio -> Close welcome screen -> killall -9 java (without this causes failed) -> Launch Android Studio -> bottom right menu in welcome screen to update -> success without error.
  • s1d
    s1d about 4 years
    Finally your method worked for me. This was on Ubuntu 18.04, upgrading Android Studio 3.4 to 4.0.
  • mYnDstrEAm
    mYnDstrEAm about 4 years
    This didn't work for me on Debian/KDE. To make it update I unchecked Is Executable in the properties of the /jre/bin/java file and checked it again before the update finished (see answer below).
  • Mushahid Gillani
    Mushahid Gillani over 3 years
    solution worked. Thanks
  • Admin
    Admin about 2 years
    just simple as this, thank you!