进程相关命令
-
查询当前运行中程序的包名
adb shell top
-
解决adb shell top 获取的进程名不全问题
adb shell COLUMNS=512 top
日志相关命令
-
导出日志
adb pull sdcard/Android/data/包名/files/
-
抓取堆栈日志
adb logcat > C:\Users\zego\Downloads\Demo\ logcat.txt
命令关键字
adb logcat
抓取Android系统日志(即堆栈日志),目录C:\Users\zego\Downloads\Demo\
为日志logcat.txt的存储路径
电量相关命令
-
获取Android手机电池温度
adb shell dumpsys battery
运行该命令后的一些状态解释:
$ adb shell dumpsys battery Current Battery Service state: AC powered: false USB powered: true Wireless powered: false status: 1 #电池状态:2:充电状态 ,其他数字为非充电状态 health: 2 #电池健康状态:只有数字2表示good present: true #电池是否安装在机身 level: 55 #电量: 百分比 scale: 100 voltage: 3977 #电池电压 current now: -335232 #电流值,负数表示正在充电 temperature: 335 #电池温度,单位是0.1摄氏度 technology: Li-poly #电池种类
其中,tempreture电池温度单位为0.1摄氏度,计算为“°C”公式:274 * 0.1 = 27.4
-
设置非充电状态
adb shell dumpsys battery set status 1
-
设置充电状态
adb shell dumpsys battery set status 2
-
设置断开充电
adb shell dumpsys battery unplug
-
重置电量数据
adb shell dumpsys batterystats --reset
-
打印电量日志
adb shell dumpsys batterystats > batterystats_log.txt