How to Run Apps in Android Studio

There are two ways in which you can test your apps 

  1. On a real device
  2. On a virtual device


To Run Apps on a real device
  1. Enable developer options in your android device
  2. Enable USB debugging or Wireless debugging
  3. Connect your device using a USB cable or Wi-Fi.
  4. Click on Run Button

👉How to Enable developer options in android devices

 1. Find Build number in your android device

For Google pixel  👉 Settings👉 About phone👉Build number

For Samsung 👉 Settings👉 About phone👉Software information 👉Build number 

  2. Tap on " Build number " 7 times
  3. Return to the previous screen and find out Developer options at the bottom

Wireless debugging

To use wireless debugging 

  1. Ensure that your workstation and device are connected to the same wireless network.
  2. Ensure that your device is running Android 11 or higher. 
  3. Ensure that you have Android Studio Electric Eel installed.
  4. On your workstation, update to the latest version of the SDK Platform Tools.

To connect to your device, follow these steps

To pair your device with QR code

  1. Open Android Studio and select Pair Devices Using Wi-Fi from the run configurations menu.
  2. The Pair devices over Wi-Fi dialog appears
  3. Select Pair device with QR code and scan the QR code
  4. After pairing, you can attempt to deploy your app to your device.

To pair your device with pairing code

  1. Select Pair device with pairing code from the Pair new devices over Wi-Fi dialog. 
  2. On your device, select Pair using pairing code. 
  3. A six-digit code appears. Once your device appears on the Pair devices over Wi-Fi window
  4. Enter the six-digit code shown on your device and select Pair .
  5. After pairing, you can attempt to deploy your app to your device.

Android Virtual Device (AVD)

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. 

To run an Android app in an emulator on your computer
Create a virtual device

1. In Android Studio, select Tools > Device Manager.



The Device Manager dialog opens. If you created a virtual device previously, it's listed in this dialog.

2. C
 lick Create virtual device.

The Virtual Device Configuration dialog appears.




The dialog shows a list of pre-configured devices, organized by category, from which you can choose. For each device, the table provides a column for its display size (in inches), screen resolution (in pixels), and pixel density (number of pixels per inch).

3. Select Phone as the category.

4.      Select a phone, such as the Pixel 5, and then click Next.

This step opens another screen where you can choose the version of Android to run on your virtual device. This lets you test your app on different versions of Android.

If there's a download link next to S, click Download > Accept > Next > Finish.
The presence of the download link indicates that the image isn't installed on your computer, in which case you must install the image before you can configure the virtual device. Expect the download to take some time to complete.


4. In the Recommended tab, choose S as the version of Android to run on the virtual device.

Android S is the latest version of Android at the time of writing, but you can choose any later stable version. For a list of stable versions, see Platform codenames, versions, API levels, and NDK releases.
Important: These Android system images use a lot of disk space, so only a few are part of your original installation. Many more versions of the Android system are available than are shown in the Recommended tab. To see them, look under the x86 Images and Other Images tabs in the Virtual Device Configuration dialog.


This action opens another screen, where you can choose additional configuration details for your device.


Note: If you see the red warning about using an image with Google APIs like in the screenshot above, you can disregard it for now.

5. In the AVD Name field, enter a name for your AVD or use the default. Leave the rest of the fields unchanged.

6.      Click Finish.

This action returns to the Android Virtual Device Manager pane.


7. Close the Device Manager dialog.

Run your app on the Android Emulator

1. Select the virtual device that you created from the dropdown menu at the top of the Android Studio window.


2. Click  on Run 

The virtual device starts just like a physical device. Expect this to take a while—potentially several minutes—for the emulator to start for the first time. The virtual device should open beside the code editor.

When your app is ready, it opens on the virtual device.

Thanks for reading!😊😊😊😊😊😊
If you enjoyed reading , Show some Love by
 clapping 👏 on this post!
If you have any suggestion share with me.