Android Virtual Devices
AVD storage location
Android development
emulator configuration
AVD management

Possible to change where Android Virtual Devices are saved?

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Installing Android Studio sets you up with a default configuration that includes storage locations for Android Virtual Devices (AVDs). However, users often seek to change these default directories due to storage limitations or organizational preferences. This article will cover how you can change where Android Virtual Devices are saved, including the technical steps and implications.

Understanding AVD Storage Locations

Android Virtual Devices are stored in a specific directory that varies based on your operating system. By default:

  • Windows: C:\Users <YourUsername> \.android\avd
  • macOS and Linux: &#126;/.android/avd

Why Change the AVD Storage Location?

  • Disk Space Management: AVDs can consume significant disk space, especially when dealing with multiple virtual devices.
  • Organization: Separating project files and virtual devices might improve workflow efficiency.
  • Performance Optimization: Storing AVDs on a separate disk could potentially improve performance.

Changing the AVD Storage Location

The storage location for AVDs can be altered by setting environment variables or using symbolic links, depending on your operating system. Below are the methods explained in detail.

Method 1: Setting Environment Variable

Android Studio uses the ANDROID_SDK_HOME environment variable to determine where to store AVDs.

Steps:

  1. Find the Desired Directory: Choose a new directory where you wish to store the AVDs.
  2. Set the ANDROID_SDK_HOME Environment Variable:
    • Windows:
      1. Open the Control Panel and navigate to System > Advanced System Settings.
      2. Click on Environment Variables.
      3. Under User variables, click New, and add ANDROID_SDK_HOME as the variable name and the new path as the value.
    • macOS/Linux:
      1. Open a terminal.
      2. Add the following line to your shell's configuration file (e.g., .bashrc , .zshrc ):
  • Locate and edit the config.ini file of the virtual device.
  • Change paths related to snapshots and images.
  • Permissions: Ensure the new directory has appropriate read/write permissions, especially important on Linux systems.
  • Backups: Always back up data before making changes to avoid accidental data loss.
  • Tooling Compatibility: Some tools might have been set with absolute paths; verify functionality post-change.
  • Environment Variable Not Recognized: Verify the changes by opening a new terminal or restarting your system.
  • AVD Manager Errors: If errors occur after relocation, check the paths in your AVD configurations and environment variable settings.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.