Moving default AVD configuration folder (.android)

WindowsAndroidAndroid EmulatorAvd

Windows Problem Overview


After installation of Android SDK, there was created .android folder on the E:\ drive. As far as I know this is the default folder of Android Virtual Devices for configuration files.

How can I move .android folder to a different location?

(eg. from E:\.android to E:\Android\.android)

Windows Solutions


Solution 1 - Windows

I've found the answer.

  • Move .android folder to E:\Android
  • Create environment variable called ANDROID_SDK_HOME and set its value to E:\Android

Setting the environment variable on Windows XP or Windows 7:

  1. Right-click on My Computer and choose "Properties"
  2. Click the "Advanced" tab
  3. Click the button "Environment Variables".
  4. Add New variable

Solution 2 - Windows

By default, the emulator stores configuration files under $HOME/.android/ and AVD data under $HOME/.android/avd/. You can override the defaults by setting the following environment variables.

The emulator searches the avd directory in the order of the values in $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/.

This page provides the list of environmental variables supported by android studio: https://developer.android.com/studio/command-line/variables

Solution 3 - Windows

The path set in ANDROID_SDK_HOME must exist. Otherwise the default path will be chosen. But it is not necessary to include .android. The AVD Manager creates a .android folder, if not found in ANDROID_SDK_HOME.

Solution 4 - Windows

In addition to the answer provided by Dariusz Bacinski, you have to include the .android folder in the ANDROID_SDK_HOME path. It was not working for me if I did not include the .android folder.

Solution 5 - Windows

If you go for this answer be aware of this note: Starting with Android Studio 4.2, the ANDROID_SDK_HOME environment variable is deprecated and has been replaced with ANDROID_PREFS_ROOT.

Solution 6 - Windows

If you want to move just the AVD folder and not everything else, use those environmental variables.

>ANDROID_EMULATOR_HOME: Sets the path to the user-specific emulator configuration directory. The default location is $ANDROID_SDK_HOME/.android/.

>ANDROID_AVD_HOME: Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large disk images. The default location is $ANDROID_EMULATOR_HOME/avd/. You might want to specify a new location if the default location is low on disk space.

Solution 7 - Windows

If you would like your avd sdcard and files on a different drive, go to $HOME/.android/avd and move the folder <AVD_NAME>.avd to someplace else

Edit $HOME/.android/avd/<AVD_NAME>.ini and change

path=<NEW_AVD_LOCATION>/<AVD_NAME>.avd

$HOME depends on your system. On windows it can be your user directory

Solution 8 - Windows

  1. (Optional) Download Rapid Environment Editor
  2. Add a new system variable

> ANDROID_PREFS_ROOT = D:\IDE\Externals\ANDROID_PREFS_ROOT (The folder you want to move to.)

  1. Save and you're done.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDariusz BacinskiView Question on Stackoverflow
Solution 1 - WindowsDariusz BacinskiView Answer on Stackoverflow
Solution 2 - WindowsRonTLVView Answer on Stackoverflow
Solution 3 - WindowsrobbashView Answer on Stackoverflow
Solution 4 - WindowsshmooView Answer on Stackoverflow
Solution 5 - WindowsMCP2019View Answer on Stackoverflow
Solution 6 - WindowsrtsketoView Answer on Stackoverflow
Solution 7 - WindowsDennis MainaView Answer on Stackoverflow
Solution 8 - WindowsCyber AvaterView Answer on Stackoverflow