app安装:
最常用 adb install apk地址
应用安装,常用于直接在系统上安装新包用于测试验证bug
常用参数(一般直接使用这三个参数一起)
-t 允许测试包
-r 替换已存在的应用程序,也就是说强制安装
-d 允许进行将见状,也就是安装的比手机上带的版本低
获取app包名
这个是获取当前界面允许时的包名(在不知道app包名时非常使用)
adb shell dumpsys window | findstr mCurrentFocus (红色框起来的就是包名)
用python可以通过正则获取这个
re.findall(r'com.(.*?)/com', output)[0]
app卸载
卸载非系统集成app:
adb uninstall 包名
卸载系统集成app:
1)获取包名
2)获取此要卸载的包名的地址:adb shell pm path 包名
3)挂载系统读写权限:adb remount
4)删除包:adb shell rm /system/app/xxxxxx/xxxxxx.apk
5)最后adb reboot重启即可
adb网络连接
1、车机和电脑属于同一局域网,车机要打开adb模式
2、新开一个端口:adb tcpip 6666
3、命令进行连接 adb connect 192.168.3.xxx:6666
app版本查询
dumpsys package com.visteon.txzing.familytime |grep version
打开安卓原生设置界面
有些车机自带很多限制可能无法连网,可以使用原生设置去连wifi
adb shell am start com.android.settings/com.android.settings.Settings 1
日志操作
实时拉日志 adb logcat -v time > D:\log_v5\log.tx
有些系统日志开发需要有指定目录的日志,直接使用pull下拉,然后压缩上传到bug附件里面: adb pull /data/xx/ D:\xx\xx
操作屏幕坐标,可以编写简单脚本
//开启/关闭(1/0)屏幕坐标:adb shell settings put system pointer_location 1
adb shell input tap #该命令是用于向设备发送一个点击操作的指令,参数是 坐标
input swipe [duration(ms)]
向设备发送一个滑动指令,并且可以选择设置滑动时长。
//滑动操作xy滑动到另一个xy
adb shell input swipe 100 100 200 200 300 //从 100 100 经历300毫秒滑动到 200 200
//长按操作
adb shell input swipe 100 100 100 100 1000 //在 100 100 位置长按 1000毫秒