android adb命令常用大全

发布于:2024-07-02 ⋅ 阅读:(10) ⋅ 点赞:(0)
android adb命令大全

1、取全量日志:

adb logcat -v threadtime > 1.log

2、dos窗口日志异常,使用命令清理下

adb logcat -G 200M

3、直接在dos命令窗口查询某个关键字

adb logcat | findStr "KeyWord"

4、查看版本号:

adb shell pm dump com.flyme.auto.update | findstr “version”
adb shell dumpsys package com.flyme.auto.update | findstr verison

5、使用命令进行截图:

adb shell screencap -p /sdcard/01.png
adb pull /sdcard/01.png D:/picture

6、进入目录删除文件

adb shell 进入目录
rm -rf 文件名称  (删除)

7、查看当前Activity页面是否在堆栈里面:

adb shell dumpsys activity top | findstr ACTIVITY

8、白天黑夜模式切换:

白天模式 adb shell "su 0 cmd uimode night no"
黑夜模式 adb shell "su 0 cmd uimode night yes"

9、强制关闭某个软件或者清除本地缓存

adb shell am force-stop "packageName"
adb shell pm clear "packageName"

10、强制拉起某个activity页面

adb shell am start -n com.example.dialog.library/.main.view.MainActivity

11、查看某个应用的进程号
例如:demo 这个apk

adb shell 
查找demo进程:
ps -ef | grep demo
kill -9 进程号

12、查看设备分辨率

查看分辨率:
adb shell wm size
设置分辨率:
adb shell wm size 1920x1200
恢复为默认分辨率
adb shell wm size reset

13、查看设备屏幕像素密度

查看像素密度:
adb shell wm density
设置像素密度:
adb shell wm density 160
重置命令:
adb shell wm density reset 

14、如何全局搜索文件下所有的log日志

1)日志解压放到log文件夹中
2)在顶部文件夹目录中输入”cmd"命令
3)在dos窗口里面进行搜索
4)findstr /s “KeyWords” *.log