Fine-tune Android Studio with JVM options for smooth experience

android-studio-logo

As android developers we love Android Studio since it make our lives much more easier. If you are a developer form a eclipse (Hats off for the big boss) era I don’t want to say anything. You may feel android studio like a heaven.

With Intelij engine and gradle android development come a long way. But you know, gradle is in fact quire resource hungry guy. Even for a simple “Hello World” application the daemon might use very well up to 150MB or even more. When it comes to multi module production level application we should provide enough resources for gradle.

You may have already experienced slowness or unresponsiveness in android studio with the latest updates (Mostly 3.1.x). When the default memory allocation of android studio  is not enough for your project you have to face this definitely. Only thing we have to do is allocate enough resources.

What you need to do is create a studio.vmoptions file in android studio settings folder. (For 64 bit version it’s   studio64.vmoptions )

Click Help > Edit Custom VM Options to open your studio.vmoptions file. (or you can create the file manually in side bin directory in  android studio installation directory e.g. : C:\Program Files\Android\Android Studio)

Then add below configuration to  studio64.vmoptions file

  • Runs JVM in Server mode with more optimizations and resources usage
    It may slow down the startup, but if you usually keep IDE running for few hours/days
    JVM may profile and optimize IDE better. Feel free to remove this flag.

  • Sets the initial size of the heap, default value is 256m

  • Max size of the memory allocation pool, default value is 1280m

  • Sets the size of the allocated class metadata space that will trigger a GC the first time it is exceeded, default max value is 350m

 

Now your  studio64.vmoptions file should look like this.

Restart the Android Studio and feel the difference.

Happy coding :)

 

Credits : https://github.com/artem-zinnatullin/AndroidStudio-VM-Options

Add read more/ less to Android TextView

In this article I’m going to show you how to add  read more/ less component to  android TextView. Finally your text view looks like this.

Screenshot_20170814-014733 (2)