Codementor Events

Speed up your Android Studio Performance

Published Apr 18, 2019
Speed up your Android Studio Performance

Yes, this tutorial promises to help you speed up your Android Studio performance which will consequently boost your productivity with the IDE. So, let’s get to it.

We are going to do this by increasing the maximum heap size of our Android studio. By default, Android Studio has a heap size of 1280 MB. For some projects, this value is perfect. However, if you are working on a large project like me 😃 or the size of your RAM is comparatively large or you are used to running Android Studio for a long time without restarting, then increasing the heap size becomes a necessity.

To get started, let’s create or open an existing studio.vmoptions file

  • On the menu bar, click Help and Select Edit Custom VM Options from the dropdown. If you haven’t edited the VM options file before, Android Studio will prompt you to create one. Click Yes to create it.

  • In the studio.vmoptions file opened in the editor, go ahead and enter the following option.

-Xmx2g

Note: 2g(2 gigabytes) is the heap size we are allocating to Android Studio which could be any size as you wish. Its unit could also be in megabytes. Mind you, this value must take into consideration the RAM size of your machine. It is advisable not to exceed half the maximum size of your system’s RAM size when allocating heap size.
Having said that, save the file and restart your IDE. The new value should override the default 1280 MB.

To verify the newly assigned heap size is active, do either of the following:

  • Run the command below in integrated IDE terminal and expect the new option to appear along with the default ones. Look out for this -Xmx2g
jps -lvm

heapsize-terminaloutput_2-2_2x.png
ref: https://developer.android.com/studio/images/intro/heapsize-terminaloutput_2-2_2x.png

  • In mean will be to go to Settings/Preferences and check the show memory indicator option which will appear at the bottom right corner of your IDE.

Conclusion
With the above, you have a better performing IDE to boost your productivity. I would like to mention at this point that this solution might not work for windows users. However, I will be making another post in that regard.

Enjoy.

Discover and read more posts from Johngorithm
get started