Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run or debug on android phone instead of emulator?

Android emulator is so slow that it is not possible to test run applications. Is there anyway to debug/run applications on real phone with IDE instead of emulator?

like image 225
SMUsamaShah Avatar asked May 24 '11 20:05

SMUsamaShah


People also ask

How can I run Android apps instead of emulator?

In the Android Studio toolbar, select your app from the run configurations drop-down menu. From the target device drop-down menu, select the device that you want to run your app on. Select Run ▷. This will launch the app on your connected device.

Can you debug an Android phone?

To enable USB debugging, toggle the USB debugging option in the Developer Options menu. You can find this option in one of the following locations, depending on your Android version: Android 9 (API level 28) and higher: Settings > System > Advanced > Developer Options > USB debugging.


2 Answers

You can generally switch on USB debugging on your handset and connect it up to your PC over USB. The handset will then appear to adb in the same way as an emulator. You might need to download drivers from your handset manufacturer for your phone.

On my HTC desire the setting is under:

Settings -> Applications -> Development -> USB Debugging

like image 118
fleetway76 Avatar answered Oct 01 '22 09:10

fleetway76


Enable USB-Debugging on your phone. Connect it to your computer. ADB should recognize it and you can use it the same way as a virtual device.

If ./adb devices lists your phone as a lot of question marks, then it is lacking some permissions. To fix this, restart the adb server as root. Something on the line of:

~$ ./adb devices List of devices attached  emulator-5554   device ?????????????   device  <--- your phone ~$ sudo -s ~# ./adb kill-server ~# ./adb devices List of devices attached  emulator-5554   device 1232345345345   device  <--- your phone 
like image 29
Hyperboreus Avatar answered Oct 01 '22 09:10

Hyperboreus