Note: This is an updated article to reflect the stable release of AS. If you are looking for the old one, please see here.
Android Studio (AS) creates a local directory .AndroidStudio to cache its own data. In most environments, this is acceptable. However, the size of the directory can easily exceed 300Mb and, if you have a space constraint on your home drive (or a roaming profile in windows), this may be better off in some other place.
The location of this directory is placed in an idea.properties file in the bin/ directory of your AS is installed. Currently (AS 1.1.), the two variables are commented out and look like this:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE config
# folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.config.path=${user.home}/.AndroidStudio/config
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system
# folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.system.path=${user.home}/.AndroidStudio/system
The previous tutorials were suggesting enabling the two variables and changing the installed file itself. This posed two problems:
- First, you'd need admin rights or some alternative to have write access to the installed idea.properties file
- Then, more importantly, AS rewrites the file with each update
Therefore, here are the steps to a friendlier approach:
-
Copy the idea.properties file locally (e.g. in
${home}/.androidStudio.properties
) -
Enable the two properties:
#--------------------------------------------------------------------- # idea.config.path=${user.home}/no-backup/.AndroidStudio/config idea.system.path=${user.home}/no-backup/.AndroidStudio/system # #---------------------------------------------------------------------
-
Create an environment variable named STUDIO_PROPERTIES pointing to the local file:
export STUDIO_PROPERTIES=${home}/.androidStudio.properties
Now, you can run AS and your cache directory will be created where you've specified.
HTH,
Member discussion: