An Android Virtual Device (AVD) is a device configuration that is run with the Android emulator. It works with the emulator to provide a virtual device-specific environment in which to install and run Android apps. Lesson 4 shows you how to create an AVD by introducing you to the Android SDK’s AVD Manager tool.

Using AVD Manager to Create an AVD

The Android SDK provides the AVD Manager tool for creating and otherwise managing AVDs. You can run this tool directly or run SDK Manager and select Manage AVDs from the Tools menu. In either case, you are greeted with the Android Virtual Device Manager window shown in Figure 8.

Android Virtual Device Manager lets you create, update, delete, repair, and start AVDs. Click the New button to create a new AVD. This application responds by presenting the Create new Android Virtual Device (AVD) dialog box shown in Figure 9.

Figure 9: The "Create new Android Virtual Device (AVD)" interface lets you enter a name for and criteria that describe an AVD.

Figure 9 shows you that an AVD has a name, targets a specific Android platform, and has other features. Enter MyAVD as the name, select Android 2.3.3 – API Level 10 as the target platform, and choose a size of 100 (megabytes) for the Secure Digital (SD) card. Apps store their data in hierarchical structures on this card.

Note: Check the Enabled checkbox in the Snapshot section if you want to persist the emulator’s state between emulator executions. Doing so lets you quickly start the emulator after the first startup.

Figure 9 also reveals that you can choose the virtual device’s skin (appearance). When you select Android 2.3.3 – API Level 10 as the target platform, the skin defaults to the built-in WVGA800 value. Furthermore, it presents the following hardware properties:

Abstracted LCD Density, set to 240 dots per inch

Max VM application heap size, set to 24 megabytes

Device RAM size, set to 256 megabytes

Tip: If you plan to run the virtual device on a platform whose screen size is set to 1024 x 768, you’ll find that you cannot see the virtual device’s entire screen without scrolling. In this case, you should set the skin to a lower value, such as HVGA (which also changes the Abstracted LCD Density to 160).

Click the Create AVD button after making these changes. You should see the confirmation dialog box that appears in Figure 10.

Figure 10: Android Virtual Devices Manager confirms your choices.

Click the OK button to dismiss this dialog box and return to Android Virtual Device Manager’s main window. You should see the new AVD listed as shown in Figure 11.

If you ever want to change this AVD’s characteristics, highlight its entry in the list and click the Edit button. You can also obtain a description of the AVD by clicking Details, and you can delete it by clicking Delete.

Review

The following review questions help you test your mastery of Lesson 4’s material:

What tool do you use to create an AVD?

What is the benefit of checking the Enabled checkbox in the Snapshot section of
the Create new Android Virtual Device (AVD) dialog box?

Jeff Friesen is a freelance tutor and software developer with an emphasis on Java and mobile technologies. In addition to writing Java and Android books for Apress, Jeff has written numerous articles on Java and other technologies for SitePoint, InformIT, JavaWorld, java.net, and DevSource.