Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to speed up Android Studio on a Mac

Tags:

android

macos

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?

like image 526
Antonio Sesto Avatar asked Feb 28 '15 17:02

Antonio Sesto


People also ask

Why does Android Studio take so long?

If Android Studio has a proxy server setting and can't reach the server then it takes a long time to build, probably its trying to reach the proxy server and waiting for a timeout. When I removed the proxy server setting its working fine.

Is Mac good for Android Studio?

Is the MacBook Air good for Android and iOS development? Yes it is. To develop android apps the most used platform is the android studio in which you code in Java and xml. Fortunately, it is available both for the windows PC and the Mac.


2 Answers

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.

like image 131
BenJaminSila Avatar answered Sep 22 '22 16:09

BenJaminSila


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.

like image 32
Naveed Ahmad Avatar answered Sep 21 '22 16:09

Naveed Ahmad