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

▼魔方 西西 提交于 2019-12-03 06:38:25

问题


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?


回答1:


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




回答2:


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



回答3:


I realize the context is for Windows, but I had the same issue on Linux (Fedora). Creating a new file in /etc/udev/rules.d/ was necessary (and restarting adb as Hyperboreus indicates).

This is indicated clearly at http://developer.android.com/tools/device.html.

fwiw




回答4:


For Windows Users:

1. Go to Command Prompt
2. Type cd /path/to/adb.exe
3. Type adb.exe devices
4. Type adb.exe kill-server
5. Type again adb.exe devices

If you get your Device, Its fine. If not, Try once again.



来源:https://stackoverflow.com/questions/6116724/how-to-run-or-debug-on-android-phone-instead-of-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!