Configure an AVD in the Android Emulator

After you code an application in Android Studio, you can build it and deploy it to a connected device or a virtual emulator device to run it. When you build a project, an Android Application Package (APK) is built for the app, and the default project activity is launched to the target device.

As we have updated the run configurations and scripts that define the project’s build specifications in the last step, we can proceed to configuring a virtual device to test the app on.

The Android Emulator facilitates the simulation of virtual android devices in Android Studio that enables you to test your application on a variety of device configurations, API levels, and hardware profiles.

If you don’t already have a virtual device set up for the app’s target API level, follow the steps mentioned below to create a virtual device through AVD (Android Virtual Device) Manager, and run the app on it.

Note:
  • If the Android Emulator is not installed in your Android Studio, navigate to Tools > SDK Manager, then select the SDK Tools tab. You can select the Android Emulator package and install it.

  • You must also ensure that you have installed an SDK package of API level 29 or higher to run on the simulated device, as we defined the target SDK as 30.


  1. Navigate to Tools > AVD Manager in the Android Studio in your project.

  2. Create a new virtual device by clicking Create Virtual Device.

  3. Select an optimum hardware profile for the API level the app targets, which is 29, then click Next.

  4. Select a system image corresponding to the target API level from the Recommended system image tab, then click Next.

    Note:
    • If you see Download next to the system image, you must download it.

    • You must ensure that you select the API level to be above the minimum SDK level the app targets, which is 21. Since we defined our target SDK as 29, you can ideally install a system image of that API level or of a higher level.

  1. You can verify the configuration properties, then click Finish to create the virtual device.


The AVD will be created and listed in Your Virtual Devices section.

Last Updated 2024-04-05 23:41:34 +0530 +0530

RELATED LINKS

Android SDK