Run or Debug Android App Using Emulator in Android Studio

In this post, we will learn how to run or debug android app using emulator in android studio. We will see how we can install AVD in android studio using AVD Manager, run android app in emulator and debug android app in emulator etc.

Getting Started

This post can be divided into below sub-sections –

  • Install And Manage AVD Using AVD Manager
  • Run Android App Using Emulator
  • Debug Android App Using Emulator

1. Install And Manage AVD Using AVD Manager

If we want to run our HelloWorld app in emulator in android studio, we need to create an android virtual device (AVD). Later, we use AVD to run our app in emulator.

As per official documentation,
An 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.

You might be confused what is an emulator then ?

As per official documentation,
The Android Emulator simulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device.

So, AVD contains real device configurations that emulator uses to simulate android device where we install and run our application to test and verify features.

1.1 Using AVD Manager to Create AVD

Android Studio provides AVD Manager that helps developers to install and manage AVD in android studio. AVD stands for android virtual device.

Follow steps below to install android virtual device –

  • Look for below icon in android studio –
    Tutorialwing Android Install Emulators android studio
  • Click on AVD Manager icon. It opens new modal –

    Tutorialwing android create virtual device tutorial with example

    Click on + Create Virtual Device

  • Now, we need to select hardware. We can even choose whether we want emulators for watch, TV, Phone or Tablet. Then, we need to select device(version, resolutions etc.) we want to install. We selected Phone => Pixel XL. Then, click Next button.

    Tutorialwing Android Create Virtual Device Select hardware example

  • Clicking on Next button redirects to next screen to select system image.

    Tutorialwing Android Select System Image Install Virtual Device

    If you already have system image downloaded and installed, you can select and proceed. However, please note that there is no system image present in our case. So, we need to download and install one. Here, we are downloading android version R. Click on download link beside R.

    • Clicking on download link shows download in progress –

      Tutorialwing Android System Image Install Progress

      Note: It may take several minutes to download based on internet speed.

      This is how modal looks when download is complete.
      Tutorialwing Android System Image Download Complete

      Click on Finish button. It will redirect back to window where we need to select system image.

    • Notice that there is no download link beside android version R. Now, select R. Then, click on Next button.

      Tutorialwing Android Select System Image Final Screen

  • Clicking on Next button redirects to below screen. Here, we need to select AVD Name. Leave other details as default value. For the sake of simplicity of this post, we are not going into that detail. Then, click on Finish button.