30

I have 8GB of RAM and 500GB hard disk but when I am using Android Studio it still freezes so much that I am unable to do my work. I have reinstalled the software without any improvement. I also formatted my system and reinstalled Android Studio again but nothing works. Can anyone tell me what can be a possible solution to this?

Alexander Rossa
  • 1,900
  • 1
  • 22
  • 37
Nishtha
  • 393
  • 2
  • 5
  • 11
  • which processor your system have? – Vishal Thakkar Aug 17 '16 at 04:40
  • which proccy? I think you need atleast i5 or equivalent – Nilabja Aug 17 '16 at 04:40
  • see this link you got idea about system recommendation for android studio https://developer.android.com/studio/index.html?gclid=CKufjoHRx84CFc8QaAodznMPsA – Vishal Thakkar Aug 17 '16 at 04:41
  • 2
    I am having i3 processor with 1.7 GHz – Nishtha Aug 17 '16 at 04:42
  • 1.7Ghz? using a laptop? – Nilabja Aug 17 '16 at 04:42
  • yes I am using a laptop.From the last 2 days it is not working properly .Earlier it use to work properly – Nishtha Aug 17 '16 at 04:43
  • i do not think you can get more performance out of it, i myself use a 2.0ghz i3 with 12gb ram and still it lags, – Nilabja Aug 17 '16 at 04:45
  • although there are few steps you can take to make it a little bit faster – Nilabja Aug 17 '16 at 04:45
  • like what steps ??? – Nishtha Aug 17 '16 at 04:48
  • it used to work alright, but not since 2 days ago? what did you do to your comp 2 days ago? you may need to clean your comp from errors or malware. – TWL Aug 17 '16 at 04:50
  • There are no malware or virus .Because my whole system is working properly .Only android studio is not working – Nishtha Aug 17 '16 at 04:51
  • 1
    1. "http://tools.android.com/tech-docs/configuration" change -Xmx4096m 2. disable vcs 3. disable instant run if you test on multiple devices 4. use dex in process https://medium.com/google-developers/faster-android-studio-builds-with-dex-in-process-5988ed8aa37e#.nilcdlouu 5. last try invalidating studio cache – Nilabja Aug 17 '16 at 04:51
  • In my case my custom view call itself, this infinity cycle lead to freezing – Roman Soviak Dec 26 '18 at 14:03
  • This problem is still occurring in 2021 and needs to be resolved. It is happening to me on an i9-10990k with 32g RAM and M2 1TB SSD with lots of space. The whole IDE hangs when this occurs. If Android Studio was properly implemented, it would at MOST hang one thread, and not the entire IDE so that menus cannot be clicked/characters cannot be typed. Seems like a threading/deadlock/priority inversion issue in Android Studio. How do we go about reporting this properly so it is fixed once and for all? @user7856586, that should only hang your app, not the IDE if Android Studio worked as it should – c.fogelklou Jan 16 '21 at 05:18

7 Answers7

8

In android studio application package content, edit studio.vmoptions file and increase "-Xms" and "-Xmx" parameters like

-Xms1024m
-Xmx4096m

UPDATE

I figured out that idea is getting error while writing or reading cache (from idea.log)

WARN - .caches.project.IdeaModuleInfo - Could not find correct module information. Reason: Analyzing element of type class com.android.tools.idea.databinding.LightGeneratedComponentClass with no containing file Text: null

Every time when android studio freezes, I delete .idea/caches/ in project folder so it fixes freeze problem temporary

Enes
  • 2,225
  • 1
  • 19
  • 16
  • 1
    Deleting the caches folder did it for me. Would be nice if code analysis didn't lock up 10 times a day. – rmirabelle Feb 01 '21 at 17:33
  • Of course, deleting caches only works ONCE. Then code analysis simply freezes again in another 5 minutes, with nothing left to delete. – rmirabelle Feb 03 '21 at 21:49
6

in my case, noticed that the number of "Recent hangs" of Android Studio was constantly increasing, and unplugged the USB cable which connected an Android phone for debugging did solve my problem.

Neil.Ling
  • 867
  • 7
  • 5
3

Clean the cache via this menu:

File -> Invalidate Caches/Restart

and then it should work properly.

sajad abbasi
  • 1,988
  • 2
  • 22
  • 43
2

This method worked for me after trying many other methods.

1. Update Android SDK tools and latest SDK platform.

2. Remove the Android Studio cache folder situated in C:\users\username\.AndroidStudioPreview2.0

3. Run Android Studio again.

Alexander Rossa
  • 1,900
  • 1
  • 22
  • 37
Sangram Haladkar
  • 707
  • 9
  • 22
1

In my case I have been connecting my phone through a VERY long USB extension cable.

Reconnecting device with a short cable solved the issue.

Alexander Rossa
  • 1,900
  • 1
  • 22
  • 37
vkkeeper
  • 277
  • 3
  • 4
1

I often switch on "Safe Mode". It disables Syntax check and Inspections, but reduces AS freezing while typing. click on man's pic in right bottom

dan1st
  • 12,568
  • 8
  • 34
  • 67
Jake Finn
  • 39
  • 3
1

IMPORTANT

I notice after I completed the below steps everything worked fine. But after I did a git commit and changed the project folder name, Android Studio froze again. To fix the issue I had to do only step 2 all over again.

I had to do 3 steps (seperately):

  1. When Android Studio first opens, I selected Android Studio then Check for Updates

  2. When Android Studio first opens, I selected File > Invalidate Caches. In the Invalidate Caches popup tik both Clear file system cache and Local History and Clear VCS Log caches and indexes then select Invalidate and Restart

enter image description here

  1. To build on Enes answer to increase the size to 4096, when the Android Studio first opens, on the Welcome screen, select More Actions > SDK Manager. On the next screen, in the left panel, select Memory Settings and then on the right panel change the IDE Max heap size to 4096 MB then select OK at the bottom.

enter image description here

enter image description here

Lance Samaria
  • 17,576
  • 18
  • 108
  • 256