44

I am trying to develop some native Android apps using Android Studio (latest) on OS X Yosemite. Currently Android Studio is simply unusable: it is too slow. I am not referring to the Android emulator, which was doubling the development time, but to the source code editor itself.

The main problem is that very often but not always (I would say almost always) it is not able to keep the pace of my editing: when I edit text, characters appear on the screen between one and two seconds later. If I delete characters, I never know which one I reached without waiting for a couple of seconds. If I right-click I wait for the equivalent of geological ages before something is displayed. It is almost impossible to use the graphical layout editor because it is sloooow.

I have also other problems, related to incredible bugs. But I want to focus on this basic functionality.

After a bit of research I ended up increasing its heap space. So I went into:

/Applications/Android Studio.app/Contents/bin

and modified these values in studio.vmoptions:

-Xms512m
-Xmx6000m
-XX:MaxPermSize=1000m
-XX:ReservedCodeCacheSize=500m
-XX:+UseCompressedOops

Actually I have only increased the allocated memory for the first two of them.

Is there anyone developing for Android on a Mac who was able to increase this basic performance of Android Studio? Is there any hidden trick, combination of JVM and options able to make this app usable?

I am working on a MBP 2.3GHz i7 with 16GB of RAM: is it enough?

11
  • It is most definitely enough. I work perfectly with android studio in a mac thats worse than that. Have you tried reinstalling?
    – user3629714
    Commented Feb 28, 2015 at 17:08
  • 3
    I seem to be having the exact same issue. I'm on a MBP 2014 (Retina) with 8 GB of RAM. I usually end up restarting Android Studio and this seems to fix the issue, but it's not a solution I find soothing, because I waste a lot of time having to do this. I haven't tinkered with any of the VM settings though. I'm on OsX Yosemite btw, so that's also another difference... On my MBP (2011 Non-Retina) with 16GB of RAM I sometimes get a little stutter, but not by as much as on the Retina.
    – Darwind
    Commented Mar 4, 2015 at 12:13
  • 1
    I am working on Yosemite too. I can't remember the name of the latest releases, with animals it was simpler. Commented Mar 4, 2015 at 15:13
  • 1
    I have Android Studio Version 3.0 and still have the same laggy typing problem.=( Commented Nov 15, 2017 at 12:49
  • 1
    In which file exactly inside the bin did you change these values? Commented Jan 26, 2021 at 1:18

8 Answers 8

41

I did the following to resolve the Android Studio slowness.

Go to Android -> Preferences -> Build, Execution, Deployment -> Compiler

Check the Option -

Compile independent modules in parallel (may require larger heap size)

Set VM Options to :

-Xmx2048m -XX:MaxPermSize=512

Restart Android Studio.

8
  • 1
    its a little bit better...but still getting alot of pinwheels while typing
    – Tim Boland
    Commented Sep 8, 2015 at 9:37
  • I'm on a 2015 mbp and typing is coming in way slow. I hoped this would help but no avail yet :(
    – Jacksonkr
    Commented Oct 12, 2015 at 22:38
  • 1
    ** Thank you all ** I am glad that this helped you. @NaveedAhmad et al Commented Jan 13, 2016 at 6:11
  • 11
    and if you cant opened android studio after this setting just remove setting in mac : vmoptions file in ~/Library/preferences/AndroidStudio3.0
    – Muklas
    Commented Nov 3, 2017 at 2:05
  • 2
    if you cannot start AS 4.X after changing, try to recover from here ~/Library/Application Support/Google/AndroidStudio4.X/studio.vmoptions Commented Sep 23, 2021 at 7:45
31

After understanding of @Benjamin and @Marco Hc, I captured a screenshot and tried to represent the solution graphically. Every number in the picture represents the flow of the solution: enter image description here

  1. Go to Android -> Preferences

  2. Click on Build, Execution, Deployment

  3. Click on -> Compiler

  4. Check the Option - Compile independent modules in parallel (may require larger heap size)

  5. Check on Use in-process build" and "Configuration on demand and click OK button

  6. Restart Android Studio and that's it.

3
  • 4
    Is Commnad-line Options the same as VM Options?
    – Leo
    Commented Mar 30, 2016 at 20:21
  • 2
    This definitely helped me
    – Adamski
    Commented Jul 31, 2016 at 21:20
  • 2
    @leonziyo no, it's not. In AS choose "Help" -> "Edit custom VM options..." - this would create a configuration file when you can override default VM settings
    – pkuszewski
    Commented Nov 22, 2016 at 6:45
6

It's more than enough, there are some tricks to improve your Android Studio performance:

With these two tricks you'll feel the difference. Let me know.

Cheers!

2

Easy way shared by Jake Wharton

First, click on Android Studio -> Preferences -> Plugins

Now, disable or check off all the plugins which not usable for you.

  • Android APK Support
  • Android Games
  • Android NDK
  • App Links Assistant
  • Copyright
  • Coverage
  • CVS Integeration
  • Editor Config
  • Fabric for Android Studio
  • Firebase (App Indexing, Services, Testing)
  • Github
  • Google (Cloud Tools Core, Cloud Tools for Android, Developer Samples, Login, Services)
  • Markdown Support
  • Mercurial integration
  • Settings repository
  • Subversion integration
  • Task management
  • Test recorder
  • TestNG-J
  • YAML

Now, click Apply -> OK

If you need any plugin later, enable it for a temporary time, do your work and then you can disable it again.

2
  • doing that maybe android studio suggest reinstall completly (that`s my case :( )
    – Andrey
    Commented Oct 14, 2020 at 20:50
  • Same for me, had to reinstall android studio Commented May 25, 2022 at 20:40
1

In my case, I saw that only Android Studio was laggy (problems while typing or using the mouse). The other apps were ok.

I had a look to "activity monitor" and saw in the "processor" and "memory" tabs that some apps regularly induced peaks on the processor graph or memory graph. You can also see that these apps move a lot in the listing (going up and down) during the peaks.

I noticed that the apps inducing peaks were:

  • "Kies" app by Samsung : I removed it from the apps launched at startup and deleted this crap app
  • "CrashPlan" (a backup app): I launched the app and logged into it (it was not logged in)
  • I desactivated Apple speech recognition in my Mac settings (a process named "applespeechrecognition" or something like that)

My Mac is now much faster and have no more problems with Android Studio ! :)

1
  • I did not and do not have those apps (besides the speech recognition). However, the rest of the applications ran fine... Commented Oct 24, 2018 at 9:28
1

Something I discovered was having Dictation turned on for the keyboard in System Preferences seems to cause a general loss of action (keyboard entry was dropping characters, clicks seemingly being dropped, window moves not working, etc.).

Disabling dictation cured all my general UI performance issues. This was done through Apple Menu | System Preferences | Keyboard | Dictation Tab | Off

0

Yes, that is enough computer. I use Android Studio on both my Mid 2011 iMac and my MBP 2.5GHz i7. Android Studio and the emulator are pretty slow to load on the iMac, but I do not have the issues while typing that you describe on either machine.

What version of Android Studio are you using?

1
  • The latest: 1.1.0 - May be the issues are related to some conflicts in the Java configuration, but I cannot figure out which ones. Commented Mar 1, 2015 at 9:22
-1

This performance issue may be caused by a cloud backup utility like Google Backup & Sync, iCloud, DropBox, or OneDrive syncing the folder or files as you edit. Try disabling the Cloud Backup daemon or removing those files from sync.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.