当你没有数据线的时候也想debug,怎么办?还有就是测试串口的时候,那个插口要被占用,无法跟电脑保持adb连接,怎么办?
话不多说。官方文档
Debugging considerations
When debugging applications that use USB accessory or host features, you most likely will have USB hardware connected to your Android-powered device. This will prevent you from having an adb
connection to the Android-powered device via USB. You can still access adb
over a network connection. To enable adb
over a network connection:
- Connect the Android-powered device via USB to your computer.
- From your SDK
platform-tools/
directory, enteradb tcpip 5555
at the command prompt. - Enter
adb connect <device-ip-address>:5555
You should now be connected to the Android-powered device and can issue the usualadb
commands likeadb logcat
. - To set your device to listen on USB, enter
adb usb
.
1:借根数据线连上手机和电脑
2:打开终端cmd,cd到sdk里的platform-tools/目录,输入adb tcpip 5555
3:查看手机ip,然后输入adb connect 手机ip : 5555
4:完成,还线