HomeAndroidHow to Configure Android Studio? - Part 1

How to Configure Android Studio? – Part 1

Working with Android Studio can make your development environment an easy to work or can be pain. Most of the experienced developers know that Android Studio provides some wizards and templates to make their development life easy. Wizards and templates helps in verifying your system requirements, such as the Java Development Kit (JDK) and available RAM. These wizards also helps in configuring default settings, such as an optimized default Android Virtual Device (AVD) emulation and updated system images. This journal entry describes additional configuration settings you may want to use to customize your use of Android Studio.

Configure Android Studio

Android Studio provides access to two configuration files through the Help menu:

  • studio.vmoptions: Customize options for Studio’s Java Virtual Machine (JVM), such as heap size and cache size. Note that on Linux machines this file may be named studio64.vmoptions, depending on your version of Android Studio.
  • idea.properties: Customize Android Studio properties, such as the plugins folder path or maximum supported file size.

Find your Configuration File

Both configuration files are stored in the configuration folder for Android Studio. The name of the folder depends on your Studio version. For example, Android Studio 2.2 has the folder name AndroidStudio2.2. The location of this folder depends on your operating system:

  • Mac: ~/Library/Preferences/<CONFIGURATION_FOLDER>/

You can also use the following environment variables to point to specific override files elsewhere:

  • STUDIO_VM_OPTIONS: set the name and location of the .vmoptions file
  • STUDIO_PROPERTIES: set the name and location of the .properties file
  • STUDIO_JDK: set the JDK with which to run Studio

Customize VM Options

To improve Studio’s performance, the most common option to adjust is the maximum heap size, but you can also use the studio.vmoptions. The studio.vmoptions file allows you to customize options for Android Studio’s JVM. The main use case of this file is to override other default settings such as initial heap size, cache size, and Java garbage collection switches.

In order to create or open your existing studio.vmoptions file use the following steps:

  • Click on Help > Edit Custom VM Options. Android Studio IDE will prompt you to create new studio.vmoptions file if you have never edited VM Options before.
  • The studio.vmoptions file will open up in the editor window of Android Studio. Go ahead and edit the file to add your own customised VM options. See Oracle’s Java HotSpot VM Options for a full list of customizable JVM options.

The studio.vmoptions file you create gets added to the default studio.vmoptions file, located in the bin/ directory inside your Android Studio installation folder.

Note: You should never directly edit the studio.vmoptions file found inside the Android Studio program folder. While you can access the file to view Studio’s default VM options, editing only your own studio.vmoptions file ensures that you don’t override important default settings for Android Studio. Therefore, in your studio.vmoptions file, override only the attributes you care about and allow Android Studio to continue using default values for any attributes you have not changed.

In part 2 of How to Configure Android Studio? we will looking into some more details, like how to maximise heap memory and second main point, i.e., idea.properties file


Most Popular