Home » Android » Failed to apply patch while updating android studio

Failed to apply patch while updating android studio

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am getting the following error while updating android studio.

I have tried increasing heap space to 2048 mb , but still i get the error.

Temp. directory: C:\Users\I306480\AppData\Local\Temp\

java.lang.OutOfMemoryError: Java heap space (failed to allocate 149228632 bytes)
    at ie.wombat.jbdiff.JBPatch.bspatch(JBPatch.java:91)
    at com.intellij.updater.BaseUpdateAction.applyDiff(BaseUpdateAction.java:112)
    at com.intellij.updater.UpdateAction.doApply(UpdateAction.java:44)
    at com.intellij.updater.PatchAction.apply(PatchAction.java:184)
    at com.intellij.updater.Patch$3.forEach(Patch.java:308)
    at com.intellij.updater.Patch.forEach(Patch.java:360)
    at com.intellij.updater.Patch.apply(Patch.java:303)
    at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:84)
    at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:75)
    at com.intellij.updater.Runner.doInstall(Runner.java:295)
    at com.intellij.updater.Runner.access$000(Runner.java:18)
    at com.intellij.updater.Runner$2.execute(Runner.java:261)
    at com.intellij.updater.SwingUpdaterUI$5.run(SwingUpdaterUI.java:191)
    at java.lang.Thread.run(Thread.java:812)

error

How to&Answers:

It Worked For me.. Wish you good luck

  • 1) Run Android Studio As Administrator.
  • 2) Close every open project.

  • 3) Goto Task Manager End/Kill JAVA Process.

  • 4) Now in Android Studio

    Start up Panel …

  • goto Config > Check For Updates

    . And when
    dialog appears .press update and restart.

Answer:

I just killed JAVA process in Windows‘ Task Manager and the installation was completed without error.

Answer:

I was having the same issue. To solve it do the following:

  • Go to MyComputer > Properties > Advanced System Settings > Environment Variables.
  • You should find a “_JAVA_OPTIONS” variable with a value like “-Xmx512M”. Simply change it to -Xmx2048M.(If you don’t find this variable, create one with exactly this name ie “_JAVA_OPTIONS” and give it a value of “-Xmx2048M”.)

Hope it helps 🙂

Answer:

Close Android.Studio, kill JAVA process in Windows Tasks, restart Android.Studio in administrator.
Aply update.

Answer:

In my case using windows 10 was the winpty-agent.exe was causing the issue which is blocking to download some files needed by the patch/update. After i close all java and started Android Studio as Administrator all working.

1- Go to Task Manager and kill any antivirus software and java process.
2- Start Android Studio as Administrator and run the update again.
3- Working… Wish you good luck…

Answer:

I did some research & found the answer myself.

When updating JVM’s heaps size was set to -Xmx500m.

I ran upgrade command in cmd(launch as admin) with -Xmx2048m .

C:\*\bin\jdk****\jre\bin\java -Xmx2048m -Djna.nosys=true -Djna.boot.library.path= -Djna.debug_load=true -Djna.debug_load.jna=true -classpath  C:\Users\XXXX\AppData\Local\Temp\jetbrains.patch.jar.androidstudio_copy;C:\Users\XXXX\AppData\Local\Temp\log4j.jar.AndroidStudio_copy;C:\Users\XXXX\AppData\Local\Temp\jna.jar.AndroidStudio_copy;C:\Users\XXXX\AppData\Local\Temp\jna-utils.jar.AndroidStudio_copy -Djava.io.tmpdir=C:\Users\XXXX\AppData\Local\Temp\ -Didea.updater.log=C:\Users\XXXX\.AndroidStudio1.2\system\log -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel com.intellij.updater.Runner install "C:\Program Files\Android\Android Studio"

I ran the above script after downloading the patch & when it asks for install options . This worked for me.

Or

Kill any running java process & run studio as administrator and update .