Is it possible to allocate these folders in another place?

I think most of the others answers address the issue, But I found more simple way for windows by adding few environment variables . (Might work for mac as well, I didn't test though)

ANDROID_SDK_ROOT - path to the SDK installation directory

default path - C:\Users\XXXX\AppData\Local\Android\Sdk Add enviroment variable ANDROID_SDK_ROOT - set value to desired location Eg: =E:\Android\local\Android\Sdk

For .android folder default path - C:\Users\XXXX\.android Add enviroment variable ANDROID_SDK_HOME- set value to desired location Eg: = E:\Android

For .gradle folder default path - C:\Users\XXXX\.gradle Add enviroment variable GRADLE_USER_HOME - set value to desired location Eg: = E:\Android\.gradle

For .androidstudioXXX

Android Studio-> Help-> Edit Custom Properties Add below lines

idea.config.path=E:/Android/.AndroidStudio4.0/config idea.system.path=E:/Android/.AndroidStudio4.0/system

Add environment variable STUDIO_PROPERTIES - set value to desired location Eg: = E:\Android\idea.properties

Finally don't forget to copy files from the original location to the new location.

Source : https://developer.android.com/studio/command-line/variables Please see the end of the page to know how to add the environment variable on Windows, Mac or Linux


Finally, I got the solution to move three of the folders that I put above. I think it could be interesting to put here the problems that I faced and the changes that I made to solve them.

I'm going to investigate about the last folder, .oracle_jre_usage, and I will complete this answer if I got a solution for it. Look that I complete the solution for .gradle folder.


To move .android folder

Really, following the steps of the blog that Rahul Tiwari provided, this folder could been moved. Nevertheless I'm going to put here all the process:

  • You have to move your .android folder, after closing Android Studio (if you have it running), to the folder in which you want that it will be stored, in my case, C:\Users\Administrator\AndroidStudio.

  • BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean, Android Studio, New Folder or similars.

  • If you are on Windows, you can do right-click on My Computer > Properties > Advanced System Settings > Environment Variables and create a new environment variable named ANDROID_SDK_HOME and as value you have to put the new path in which .android folder will be stored. It's the same path in which you have moved the .android folder in the step above.

  • Click "OK" button to accept your changes.

  • Re-launch Android Studio and look that the .android folder doesn't appear in the default path.


To move .AndroidStudio1.3 folder

With that folder I had some problems because I didn't noticed some details that were very important. Here the steps that I followed:

  • First of all, you have to close Android Studio before doing any change.

  • After, you have to move the folder .AndroidStudio1.3 to the path in which you want that it will be stored.

  • Next, you have to go to the folder in which Android Studio were installed and open "idea.properties" file and changed the lines where idea.config.path and idea.system.path appeared for the new path in which these folders are going to be located.

They have to be something similar to this:

idea.config.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/config

idea.system.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/system

Here I had three problems so please be careful:

  • Notice that the paths are with / and not with \ as Windows put by default.
  • DON'T CHANGE the values of idea.plugins.path and idea.log.path (My EDIT 3). Be sure that you are changing idea.config.path and idea.system.path values.
  • Uncomment the lines in which idea.config.path and idea.system.path appears. I mean, remove the # that they have at the begining of each line.
  • The last step, re-launch Android Studio.

Searching and doing some proves I also get the solution to move .gradle folder. The steps are the same as .android folder but I put here all the steps (with the values that changed) to avoid any confusion. Here it is:

To move .gradle folder

  • You have to move your .gradle folder, after closing Android Studio (if you have it running), to the folder in which you want that it will be stored, in my case, C:\Users\Administrator\AndroidStudio\.gradle.

  • BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean, Android Studio, New Folder or similars.

  • If you are on Windows, you can do right-click on My Computer > Properties > Advanced System Settings > Environment Variables and create a new environment variable named GRADLE_USER_HOME and as value you have to put the new path in which .gradle folder will be stored. It's the same path in which you have moved the .gradle folder in the step above.

  • Click "OK" button to accept your changes.

  • Re-launch Android Studio and look that the .gradle folder doesn't appear in the default path.



How to move data from %UserProfile%

The folders will still remain under %UserProfile%, but not the data.


Move .android

  1. Android Studio is closed
  2. Add Environment Variable

    Create "System variable":

    Variable name: ANDROID_SDK_HOME

    Variable value: D:\Android


Move .AndroidStudio

This is a example with Android Studio version 3.1

  1. Start Android Studio
  2. Help -> Edit Custom Properties...
  3. Click Yes to create file
  4. Edit file with:

    idea.config.path=D:/Android/.AndroidStudio3.1/config

    idea.system.path=D:/Android/.AndroidStudio3.1/system

  5. The file "idea.properties" is located under:

    %UserProfile%/.AndroidStudio3.1/config

  6. Close Android Studio

  7. Delete all under %UserProfile%/.AndroidStudio3.1 except the file "/config/idea.properties"
  8. Optional: Delete older version folders of .AndroidStudio

Don't edit "Android Studio/bin/idea.properties". When updating Android Studio this file is cleared.


Move .gradle

  1. Start Android Studio
  2. File -> Settings... -> Gradle
  3. Change "Service directory path" to:

    D:/Android/.gradle


Update Android Studio

  1. Start Android Studio
  2. "Import Studio settings from" is showed
  3. Select: D:/Android/.AndroidStudio3.0/config

At least for Android 3.0 the steps in the accepted solution are not enough to be able to run the emulators after moving the .android folder (let's say you moved the folder from c:\Users\<username>\.android to I:\Programs\AppData\.android). In addition you need to

  1. Copy (or leave) files adbkey and adbkey.pub in old location (i.e. c:\Users\<username>\.android\adbkey, c:\Users\<username>\.android\adbkey.pub)
  2. Replace the old location path string C:\Users\<username>\ in all .INI files found in the new avd location (i.e. in I:\Programs\AppData\.android\avd) with the new location path string I:\Programme\AppData\
  3. Delete all *.qcow2 files from the new avd location (i:\Programme\AppData\.android\avd) which contain the old location path string c:\Users\<username>\. Check Qcow2-files refer to incorrect/nonexistent base-images for an alternative to delete the *.qcow2 files. If you delete the files all data in the emulator is lost, in this case you will get a clean version of Android, like after a hard reset.