DEV Community

Move Android Studio Virtual Devices to Another Hard Drive on a Mac

Olivier “Ölbaum” Scherler on February 06, 2019

Imagine you’d like to reclaim space on your Mac’s main hard drive by moving your Android Studio Virtual Devices (the phones and tablets you run in ...
Collapse
 
th0rgall profile image
Thor Galle

Wow, thanks! A macOS quirk I hadn't expected. This is something Android Studio could have worked around, if it had just loaded ANDROID_AVD_HOME from my default shell's~/.zshrc config. It seems like VSCode with the Flutter extension does this, and that works much more intuitively.

Collapse
 
gaurav__ead0f62a2b9 profile image
Gaurav Sharma

Thank you for your post.
I am able to change AVD folder location. After restarting Androidstudio new .ini and device folder was created. But AVD device is not loading ,refer attached image :(

Image description

Collapse
 
charlesc_ai profile image
CharlesC.ai

Thank you for the great finding, saved me hours on search on the Internet.
It is PITA to deal with Android Studio env variables

Never thought of the "launchctl"

Collapse
 
dhineshvenkat profile image
Dhinesh

Yo!! Can you make a video demonstrating this. I don't understand this "/Users/[YOUR_USER_NAME]/.android_studio_env_vars". I can't create a folder like this.

Collapse
 
th0rgall profile image
Thor Galle

/Users/[YOUR_USER_NAME] is the macOS home directory of your currently logged in user. You don't need to create it, it already exists!

You need to create the hidden text file .android_studio_env_vars within your home directory. You can find your home folder with a bunch of tutorials on the internet (like this one). To create the text file, you could:

  1. Open TextEdit
  2. Press Command+Shift+T to switch to plain text mode
  3. Copy-paste the example, and change it as needed.
  4. Save the file with the name .android_studio_env_vars to your home folder.
Collapse
 
deryni profile image
Oleksii Shamarin

export ANDROID_AVD_HOME='/Volumes/LargeHDD/Android/avd'
launchctl setenv ANDROID_AVD_HOME "$ANDROID_AVD_HOME"

That worked for me.
Also I had to manually change all ini files.