Saturday, November 7, 2015

Android Studio: AVD Manager

Managing AVDs with AVD Manager

The AVD Manager is a tool you can use to create and manage Android virtual devices (AVDs), which define device configurations for the Android Emulator.
To launch the AVD Manager:
  • In Android Studio, select Tools > Android > AVD Manager, or click the AVD Manager icon  in the toolbar.
  • Or, use the command line to navigate to your SDK's tools/ directory and execute:
  • $ android avd
The AVD Manager main screen shows your current virtual devices, as shown in figure 1.
Figure 1. The AVD Manager main screen shows your current virtual devices.
Note: If you launch the AVD Manager from the command line, the UI is different than how it appears in Android Studio, as documented here. Most of the same functionality is available, but the command-line version of the AVD Manager is currently not documented.

Creating an AVD

You can create as many AVDs as you would like to use with the Android Emulator. To effectively test your app, you should create an AVD that models each device type for which you have designed your app to support. For instance, you should create an AVD for each API level equal to and higher than the minimum version you've specified in your manifest<uses-sdk> tag.
To create an AVD based on an existing device definition:
  1. From the main screen (figure 1), click Create Virtual Device.
  2. In the Select Hardware window, select a device configuration, such as Nexus 6, then click Next.
  3. Figure 2. The Select Hardware window.
  4. Select the desired system version for the AVD and click Next.
  5. Verify the configuration settings, then click Finish.
  6. If necessary, click Show Advanced Settings to select a custom skin for the hardware profile and adjust other hardware settings.
To launch the AVD in the Android Emulator, click the launch button  in the list of AVDs.

Creating a device definition

In case the available device definitions do not match the device type you'd like to emulate, you can create a custom device definition for your AVD:
  1. From the main screen (figure 1), click Create Virtual Device.
  2. To begin you custom device by using an existing device profile as a template, select a device profile then click Clone Device.
  3. Or, to start from scratch, click New Hardware Profile.
  4. The following Configure Hardware Profile window (figure 3) allows you to specify various configurations such as the screen size, memory options, input type, and sensors.
  5. When you're done configuring the device, click Finish.
  6. Figure 3. The Configure Hardware window when creating a custom device configuration.
  7. Your custom device configuration is now available in the list of device definitions (shown after you click Create Virtual Device). To continue preparing an AVD with your custom device configuration, select the new configuration and follow the instructions above to create an AVD with an existing device definition (and select your new definition).


No comments:

Post a Comment