How To Run / Debug Android App In Android Studio

Android applications can be executing or debugging in either virtual device or real device. But it can be executed or debugged in only one device at the same time. This article will show you how to do that.

1. Run / Debug Android App In Virtual Device.

  1. Setup and launch a virtual device simulator, you can read the article How To Create Android Virtual Device (AVD) In Android Studio to learn more.
  2. Select the activity java class that you want to run/debug from the top toolbar drop-down list. Click the run button ( green triangle ) to run it or click the debug button ( green triangle on a bug ) to debug it.
  3. You can also right-click the activity class in the android studio left project view panel, then click the Run / Debug submenu in the popup menu list to run / debug the android activity.
  4. Then Select Deployment Target window will pop up, there are two sections in the list, one is Connected Devices the other is Available Virtual Devices.
  5. Select the device you need from the Available Virtual Devices list. Click the OK button. If the selected device is not started up, it will start up a virtual device simulator automatically.
  6. Then the AVD simulator will startup and the android application will run in it.

2. Run / Debug Android App In Real Devices.

  1. You need to enable USB debugging mode in a real android device first. Please read the article How To Enable USB Debugging Mode On Android Device to learn more.
  2. Connect the physical device with the PC using a data line.
  3. Run / debug the selected activity java class, choose the real device in the Select Deployment Target window Connected Devices area.
  4. Click the OK button, then the Instant Run dialog popup, click Proceed without Instant Run button. Then the app will execute on your real device, you can see the result on the real device’s screen.
  5. If you want to learn more detail about debugging the android applications, please read the article Debug Android App With Android Studio Examples.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.