一、adb
连接
1.连接夜神模拟器:adb connect 127.0.0.1:62001
2. 连接安卓实机:打开手机的开发这模式,用数据线(能够数据传输)连接
3. adb devices 查看已连接的设备
4. adb get-state 查看已连接设备的状态
ps:adb连不上可能是因为:
1.数据线不是原配数据线,不能进行数据传输
2、adb版本太低,不适用于高版本的安卓系统
打印日志
安卓底层为linux,有四个缓冲区:main、system、redio、events
1.adb logcat -b main > d:\main.log app的操作日志,应用程序的操作日志
2.adb logcat -b system > d:\system.log 系统组件的日志
3…adb logcat -b redio > d:\redio.log 通讯日志
4.adb logcat -b events > d:\events.log 操作事件日志
5.adb logcat 默认输出main、system两个缓冲区的日志
6、adb logcat -c 清除日志
文件拷贝、安装、卸载
1.adb push D:\pushlog /dev/log 电脑推送到手机
2.adb pull /data/data/pulllog/bugreport.log D:\pullfile 从手机拷贝文件到电脑
3.adb shell dumpsys window | findstr mCurrentFocus 查看当前正在运行的app包名
4.adb install D:\base.apk 安装apk包
5.adb uninstall 包名 卸载应用,指定包名
性能测试
参考:https://www.jianshu.com/p/6c0cfc25b038
二、Monkey
monkey常用命令
1、adb shell monkey -p 包名 -v-v-v 100 >D:/monkey1.txt 导出monkey日志
2、adb shell monkey -p 包名 -v -s 1326438683456 100 加上种子数用于复现问题
3、adb shell monkey -p 包名 -v -s 16376347674 --throttle 1000 100 加上时间间隔,单位为毫秒(参数不分位置先后)
4、adb shell monkey -p 包名 --pct-touch 10 -v 1000 指定操作事件的百分比
monkey的参数类型如图:
具体的参数含义参考博客:https://www.cnblogs.com/aland-1415/p/6949964.html
关闭monkey
1、adb shell ps | grep monkey 找到进程号
2、adb shell kill 进程号
monkeyscript编写