持续记录......
5、log
1. 获取指定log:adb shell logcat -b events(system/kernel等)
2. 指定tag:adb shell logcar -b events -s "am_kill"
4、 手机重启/关机命令
- 重启
- 一台:adb reboot
- 多台:adb -s device1 reboot
- 关机
- 一台:adb shell reboot -p
- 多台:adb -s device1 shell reboot -p
3、2020/12/1 新增 修改手机系统时间命令:
1. 修改时间命令
adb shell date -D %T "02:58:50" %F "2020-12-12"
2. 查看修改后的系统时间
adb shell date
可以看到如下结果:
2、查看手机中的应用包名:
1. 查看应用包名和activity
adb shell dumpsys |grep mCurrentFocus
2. 查看手机中所有应用包名:
adb shell pm list packages -s
3. 查看当前应用的包名:
adb shell dumpsys activity a | find "mFocusedActivity"
4. 查看当前应用包名和activity(最好用)
adb shell dumpsys window | findstr mCurrentFocus
1、将执行结果输出到txt文本(第三中方法是用Cppcheck工具检查C文件时,前两种方法就不能把屏幕上的所有信息输出到文本)
第三条参考:linux shell中"2>&1"含义 - hongxinerke - 博客园
1. 一般用法
adb shell dumpsys meminfo >test.txt
2. 另一种用法
adb shell dumpsys meminfo |tee test.txt
3. 另一种用法
D:\python36\CodeReview\Cppcheck\cppcheck.exe D:\python36\AgentCore\ccFile\cc.c >test.txt 2>&1