Android AVD - Android Virtual Device

👉 Overview


👀 What ?

Android Virtual Device (AVD) is a configuration that defines the characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive OS device that you want to simulate in the Android Emulator. It works with the emulator to provide a virtual device-specific environment in which to install and run Android apps.

🧐 Why ?

The AVD is an essential tool for Android developers as it allows them to test their applications on different Android devices and versions without needing to have each physical device. The AVD simulates the expected behavior of the Android device, allowing the developers to debug their applications and ensure that it runs correctly. It is also useful for end-users who wish to use Android applications on their PC.

⛏️ How ?

To create an Android Virtual Device (AVD) follow these steps: \n1. Open the AVD Manager by clicking AVD Manager in the toolbar.\n2. In the AVD Manager, click Create Virtual Device.\n3. In the Select Hardware screen, select a phone device, such as Pixel 3, and then click Next.\n4. In the System Image screen, select a recent Android version, preferably the highest API level. If you don't have that version installed, a Download link is shown, so click Download to install it.\n5. On the Android Virtual Device (AVD) screen, leave all the settings alone and click Finish.

⏳ When ?

The use of Android Virtual Devices began with the launch of the Android SDK by Google. It has been a part of Android Studio, Google's official integrated development environment for the Android operating system, since its inception.

⚙️ Technical Explanations


The Android Virtual Device (AVD) is a tool provided by Google’s Android SDK, designed to represent specific Android devices. By using AVDs, developers can simulate different Android devices to test their applications without needing the physical devices.

Creating an AVD involves defining a hardware profile, which includes the device's screen size, memory size, and supported sensors. The system image is also selected, which determines the version of Android the device will run.

Storage is another aspect that can be defined in an AVD, determining how much internal storage the device has. The skin refers to the appearance of the device in the emulator, which can mimic the look of various real-world Android devices.

The Android Emulator then uses the AVD configuration to determine the functionality and behavior of the simulated device. This allows developers to predict how their applications will behave on different devices and Android versions.

AVDs also allow the definition of specific hardware aspects of the emulated device. This means developers can create many configurations to test many Android platforms and hardware permutations.

Once an application is running on the emulator, it can access all the services of the Android platform, such as invoking other applications, accessing the network, playing audio and video, storing and retrieving data, notifying the user, and rendering graphical transitions and themes.

In addition, the application can use any APIs available in the Android platform or any of its included libraries. This means it can take full advantage of Android’s capabilities, just as it would on a real device.

Here's a detailed example of creating and using an Android Virtual Device (AVD) in Android Studio:

Example: Creating an AVD for a Pixel 3 device running Android 11

  1. Open AVD Manager: Go to Tools > AVD Manager in Android Studio.
  2. Create Virtual Device: In the AVD Manager, click on Create Virtual Device.
  3. Select Hardware: Select Pixel 3 from the list of available devices and click Next.
  4. Select System Image: Choose R (or API 30) for Android 11. If it's not installed, click Download to get the system image and install it.
  5. Configure AVD: Name your AVD (e.g., Pixel3_API30) and leave other options as default. Click Finish.

Example: Running an application on the AVD

  1. Build Your App: Write your app's code and build it in Android Studio.
  2. Select Run Device: Click on the Run icon in the toolbar. In the Select Deployment Target window, choose the AVD (Pixel3_API30) you created and click OK.
  3. Use the Emulator: Your app will now launch in the emulator. You can interact with it as if you were using a physical Pixel 3 device running Android 11.

This process allows developers to fully test their applications on a variety of Android devices and versions without needing to have each physical device.

We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.