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.
- Setup and launch an virtual device simulator, you can read article How To Create Android Virtual Device (AVD) In Android Studio to learn more.
- 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.
- You can also right click the activity class in left project view panel, click Run / Debug sub menu in the popup menu list.
- 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.
- Then the avd simulator will startup and the android application will run in it.
2. Run / Debug Android App In Real Devices.
- 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.
- Connect physical device with PC use a data line.
- Run / debug the selected activity java class, choose the real device in Select Deployment Target window Connected Devices area.
- 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.
- 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)