3 ways to reduce space used by Android Studio in C drive

We have a Asus Transformer Book and occassionally I use it for Android programming especially when I am at remote location (Desktop PC is still our first choice). Sadly, it only has 32GB on its first drive. Even after installing Android Studio and SDK on drives other than C drive, AS itself will still use C drive for cache and virtual drives. 

Andrid Studio version: 1.1 RC 1
Tested OS: Windows 7

Compiler

In our example, we move some big folders of AS from C drive to D drive. The first step is to move Gradle compiler folder, which is pretty straightforward using GUI:

gradle-setting.jpg

  1. From Android Studio, go to File > Other Settings > Default Settings.
  2. Select Gradle.
  3. Change Service directory path to desired folder.
  4. Save the setting.

At this point, you may close Android Studio, move .gradle from C drive (usually C:\Users\yourusername\.gradle) to destination folder. Reopen AS. AS should be working fine and .gradle will not be recreated at C drive.

 

Android Virtual Devices

windows_path.jpg

Our next step is to move .android folder containing virtual devices to other drive. This involves modifying PATH information in Windows environment.

  1. Close Android Studio if any.
  2. Move .android folder (usually at C:\Users\yourusername\.android) to destination drive (e.g. D:\Android)
  3. From Windows, go to Control Panel > System > Advanced system settings
  4. Go to Advanced tab > Environment Variables.
  5. Under System variables, click New... button.
  6. Type in the following:
    Variable name: ANDROID_SDK_HOME
    Variable value: D:\Android
  7. Click OK and OK again. 

 

Cache Folder

idea_properties.jpg

Our last step is to move presumably cache folder for AS. This involves editing a text file of AS to tell AS to refer to custom location for cache folder.

  1. Close AS if any.
  2. Move .AndroidStudio to destination drive (e.g. D:\Android)
  3. Go to the folder where AS is installed (e.g. C:\Program Files\Android Studio).
  4. Go to bin directory and edit idea.propertis file using your favourite text editor.
  5. Uncomment and edit the following two lines. Point them to new location:
    idea.config.path
    idea.system.path

Re-launch AS again. Make sure .android, .AndroidStudio and .gradle folders are not re-created at C drive. Happy coding.

About the Author

waco_avatar_s.jpg

CheeWah (Waco) has more than 10 years working experience in IT fields, especially in software development and testing. Some of the key projects included software development and support for production/R&D, software test automation, and Search Engine Optimisation (SEO). He is a food lover and has a food blog at www.noweating.com. Little CPU acts as his IT knowledge sharing hub.