Beginning Android: Create an Android Virtual Device

Share this article

Lesson 4: Create an Android Virtual Device 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.
Figure 8: Android Virtual Device Manager lists existing AVD entries in terms of their names, target names, and other criteria.
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 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.
Figure 11: Android Virtual Device Manager presents the newly created AVD.
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?

Frequently Asked Questions (FAQs) about Creating an Android Virtual Device (AVD)

What are the system requirements for creating an Android Virtual Device (AVD)?

To create an Android Virtual Device (AVD), you need to have the Android Studio installed on your system. Android Studio is compatible with Windows, macOS, and Linux platforms. The specific system requirements vary depending on the platform. For Windows, you need a Microsoft Windows 7/8/10 (32- or 64-bit) system with a minimum of 3 GB RAM (8 GB recommended), and up to 2 GB of available disk space (4 GB Recommended). For macOS, you need a Mac running macOS 10.10 (Yosemite) or higher, up to 2 GB of available disk space, and a minimum of 3 GB RAM, 8 GB RAM recommended. For Linux, you need a GNOME or KDE desktop, 64-bit distribution capable of running 32-bit applications, and the same RAM and disk space requirements as Windows and macOS.

How can I manage my Android Virtual Devices (AVDs)?

Android Studio provides an AVD Manager tool for creating and managing your AVDs. You can access the AVD Manager from the Android Studio’s main toolbar. From the AVD Manager, you can create new AVDs, edit existing ones, or delete the ones you no longer need. You can also start an emulator session from the AVD Manager by clicking on the “Play” button next to the AVD you want to launch.

Can I create an AVD for a specific Android version?

Yes, you can create an AVD for a specific Android version. When creating a new AVD in Android Studio, you can choose the Android version for your AVD in the “System Image” step. You can select from a list of available system images for different Android versions. If the system image for the Android version you want is not installed, you can download it from the same screen.

What is the difference between a hardware profile and a system image in AVD?

A hardware profile in AVD defines the characteristics of a device including the screen size, memory size, and whether the device has a hardware keyboard or not. On the other hand, a system image is a snapshot of an Android system that the emulator uses to run the AVD. It includes the operating system, system-level apps, and settings.

Can I run an AVD on a device with low system resources?

Running an AVD requires a significant amount of system resources. If your device has low system resources, you may experience slow performance or the AVD may not run at all. However, you can optimize the AVD for low-resource devices by choosing a lower-resolution screen size and disabling features that you don’t need.

How can I troubleshoot issues with my AVD?

If you’re experiencing issues with your AVD, you can use the Android Device Monitor tool in Android Studio to troubleshoot. The Android Device Monitor provides a variety of tools for debugging and monitoring your AVD, including a logcat, a network traffic monitor, and a method trace view.

Can I simulate different network speeds in my AVD?

Yes, you can simulate different network speeds in your AVD. In the AVD Manager, you can configure the network speed and latency for your AVD. This allows you to test how your app performs under different network conditions.

Can I use the Google Play Store in my AVD?

Yes, you can use the Google Play Store in your AVD. When creating a new AVD, you can choose a system image that includes the Google Play Store. This allows you to install and test apps from the Play Store in your AVD.

How can I update the system image of my AVD?

To update the system image of your AVD, you need to download the new system image from the Android Studio SDK Manager. Once the new system image is installed, you can create a new AVD using the updated system image.

Can I create multiple AVDs?

Yes, you can create multiple AVDs in Android Studio. This allows you to test your app on different device configurations and Android versions. You can manage all your AVDs from the AVD Manager in Android Studio.

Jeff FriesenJeff Friesen
View Author

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.

androidAndroid TutorialsTutorials
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week