有的时候手机没有办法连接到电脑上看日志,这怎样才好呢?可以使用adb命令,通过网络来连接设备。
1.设置端口
adb tcpip 5555
2.连接设备
adb connect 192.168.1.5:5555
ip地址需要换成自己的设备地址。
3.先清除设备中之前的日志
adb logcat -c
一般设备保留从上次启动到当前的日志,会有许多无用的日志,所以要先清理一下。
4.查看日志
显示详细时间打印日志
adb logcat -v time
只打印错误日志
adb logcat -v time *:E
打印某一个tag的日志
adb logcat -v time mytag:V
将日志保存到某文件中
adb logcat -v time *:V > /home/hyjiao/mylog.txt
>后面的是文件位置,上面的例子是linux下的目录。如果是windows可以是这样子的:D:log.txt。
如果想知道logcat其它的操作,可以输入命令:
adb logcat -help
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.