14

I have an extremely disturbing laggy Android Studio editor. I read all proposed optimisation suggestions on the stack and did following things to speed it but nothing helped.

  • Increased the Heap Size in VM options with following options
  • Disabled all the plugins regarding git, svn etc.
  • Checked the followings in Compiler settings
  • Compiler independent modules
  • --offline in command line options
  • Configure on demand

My Device is an MBP from middle 2015 with 16 GB Ram and 512 GB SSD HD.The project is a Java Project which was ok on my other laptop. Any other things I can do?

Samir Bhatt
  • 3,041
  • 2
  • 25
  • 39
Ilker Baltaci
  • 11,644
  • 6
  • 63
  • 79
  • 1
    Is it only for a specific project? – loshkin Nov 15 '17 at 13:11
  • no it's on all of my projects. – Ilker Baltaci Nov 15 '17 at 13:12
  • on soft side, what we Android developers need to do is to make a petition and protest against Google to bring ADT for eclipse back :D – mfaisalhyder Nov 15 '17 at 13:12
  • I don't see It that bad. intelij is making very good IDEs normally. =).Eclipse would work faster for sure but in long run its more or less working with a heavy note editor =) – Ilker Baltaci Nov 15 '17 at 13:17
  • lol that guy who answered this question has down voted my answers :D what a loser he would be.... for just pointing out that what ever he wrote was not an aswer he blatantly went to downvote my my two top answers... woah, must be university kiddo. – mfaisalhyder Nov 15 '17 at 13:19
  • Check if other Apps are running in the Background. I had a Netsync Client which caused Laggs in Android Studio.^^ – daemmie Nov 15 '17 at 13:19
  • Have you tried invalidate caches / restart? https://stackoverflow.com/questions/42679475/android-studio-slow-performance – Toris Nov 15 '17 at 15:19
  • @MuhammadFaisalHyder >that guy who answered I had??? – Toris Nov 15 '17 at 15:24
  • @Toris I invalided caches and restester multiple times. – Ilker Baltaci Nov 15 '17 at 15:26
  • 1
    @Toris nopes buddy, he was an apple fanboi kid. xD showing off his mac and 4k ultra wide monitor in his answer :D – mfaisalhyder Nov 15 '17 at 15:32
  • @FierceFox From the memory perspective Android Studio requires for bigger projects around 1.5, the java its self also 1.5 but what I wonder is java reaches during compilation up to 400 % of CPU consumption and then sinks back to normal. – Ilker Baltaci Nov 16 '17 at 07:36
  • I have similar workstation. It's very disappoint to work with android studio. Some times you know you hit the key and it doesn't trigger. In my case it looks like a thread not optimised looking for keys pressed. The first time I hit 2xshift (search everywhere shortcut) it doesn't work. Sublime or xcode work fine in this aspect. – Ratata Tata May 27 '18 at 21:04
  • power save mode! on the bottom right corner. click the man. – dcarl661 Oct 30 '19 at 00:13

3 Answers3

8

Thank you guys for all advices. After having eye cancer with laggy editor I finally managed to speed it up. Fortunately It was not only the fault of the Android Studio itself, so that we can't blame it directly =)

As @FierceFox suggested I saw that windows server was working quite hard in the background and eating my CPU as well my memory.

sudo rm /Library/Preferences/com.apple.windowserver.plist
sudo rm ~/Library/Preferences/ByHost/com.apple.windowserver*.plist

Restart MacOSX with PRAM reset (hold the P and R keys while holding down the option (⌥) and command (⌘) keys before the gray boot screen appears)

Now My Editor is working fine again.

UPDATE:

As soon as I choose scaled resolution, the editor gets laggy again.! So it only works fine in default resolution.The problem is actualy only valid for Android Studio.In Xcode it seems to be OK.

Ilker Baltaci
  • 11,644
  • 6
  • 63
  • 79
  • 5
    +1 for the Scaled Resolution update. I use a 4k monitor and if I go for the "Looks like 3360 x 1890" option the UI is really laggy, the other ones seem to work fine. – patrick.elmquist May 09 '18 at 08:09
  • One more thing, First save all work and quit AS, then open activity monitor and force quit the window server. It will lock the screen and then open mac again, and there you go, no lags – Pulkit Jul 18 '19 at 20:06
  • If you still want larger text, even with an un-scaled display, you can go to `Preferences->Editor->General` and enable `Change font size (Zoom) with Command+Mouse Wheel`. – Nathan F. Nov 25 '19 at 18:26
  • for me its just work with remove windowserver.plist – Yohanim Jan 12 '21 at 15:49
0

I've experienced same problem. It was buildTools version 25.0.2, but these worked that time.

  1. Kill ADB once.

  2. Version dependent lag. Try another buildTools version.

  3. Avoid re-trigger completion (ex. kill a letter with back space) while editing. Code completion is a large part of lag.

Toris
  • 2,348
  • 13
  • 16
0

Try reading the IntelliJ logs for hints on what went wrong. You can find the logs with the toolbar in Help/Show Log in Finder (or Explorer).

In my case I had modules that cyclically depended on each other which was causing an infinite loop on the ManifestMerger. Others also seemed to have a problem with git, check Android studio using > 100% CPU at all times - no background processes appear to be running

Fenfen
  • 1
  • 1
  • 1