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 an virtual device simulator, you can read article How To Create Android Virtual Device (AVD) In Android Studio to learn more.
  2. Select want to run / debug activity java class from top tool bar drop down list. Click run ( green triangle ) button to run it, or debug button to debug it.
    android studio top tool bar activity drop down list and run debug button
  3. You can also right click the activity class in left project view panel, click Run / Debug sub menu in the popup menu list.
    right click activity class to run or debug
  4. Then Select Deployment Target window will popup, there are two sections in the list, one is Connected Devices the other is Available Virtual Devices. Select the device you need from the list. Click OK button. If the selected device is not startup, it will startup a virtual device simulator automatically.
    android select deployment target connected device or available devices list
  5. 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 real android device first. Please read article How To Enable USB Debugging Mode On Android Device to learn more.
  2. Connect physical device with PC use a data line.
  3. Run / debug the selected activity java class, choose the real device in Select Deployment Target window Connected Devices area.
    android select deployment target connected device or available devices list
  4. Click OK button, Instant Run dialog popup, click Proceed without Instant Run button. Then app will execute in your real device, you can see the result in the real device’s screen.
  5. If you want to learn more detail about debug android application, please read Debug Android App With Android Studio Examples.
(Visited 228 times, 1 visits today)
READ :   Android ActionBar Tab Navigation Example

Leave a Reply

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.