adb命令总结

录屏
adb shell screenrecord /sdcard/music.mp4

导出到当前路径
adb pull /sdcard/file.mp4

adb push $push_path/$apk_name  $install_path

adb install -r xxx.apk

adb shell am broadcast -a intent.action.xxx

adb shell am start-activity com.android.xxx


adb shell settings put system 字段 参数

adb shell setprop qemu.hw.mainkeys 0

adb shell getprop +“具体的属性对应的名称”就可以读取你想要的属性了。

如果不知道具体的属性是什么名称也可以先输入adb shell getprop命令回车,就会显示出所有手机所支持的属性名称及对应的值。

系统属性https://blog.csdn.net/xfznlzz106/article/details/79450127

GPU分析
adb shell dumpsys gfxinfo <PACKAGE_NAME>
内存分析
adb shell dumpsys meminfo $package_name or $pid
耗电分析
adb shell dumpsys batterystats

adb shell dumpsys window windows | grep "Window #"
adb shell dumpsys SurfaceFlinger
adb shell dumpsys window
adb shell dumpsys activity service SystemUIService

adb shell am broadcast -a com.android.test --es test_string "this is test string" --ei test_int 100 --ez test_boolean true

adb shell ps|grep  systemui
adb shell ls proc/5759/
adb shell cat proc/5759/maps

adb shell ps -A

把一个手机的存储空间快速塞满

adb shell dd if=/dev/zero of=/storage/sdcard0/dummy_file bs=400000000 count=1


设置device owner

adb shell dpm set-device-owner 'com.android.cts.verifier/com.android.cts.verifier.managedprovisioning.DeviceAdminTestReceiver'


push框架

adb push \out\target\product\msm8996\system\framework\services.jar /system/framework
adb push \out\target\product\msm8996\system\framework\framework.jar /system/framework/framework.jar
adb push \out\target\product\msm8996\system\framework\arm64 /system/framework/arm64/
adb push \out\target\product\msm8996\system\framework\arm /system/framework/arm/
pause
adb reboot

清除密码

adb shell rm /data/system/locksettings.db

adb reboot

配合adb可使用linux指令

find . -name "*.java" |xargs grep -n "www.dutycode.com"
find . -name "*.c" 在当前目录及其子目录(用“.”表示)中查找任何扩展名为“c”的文件
从根目录下开始查找所有txt扩展名的文件,并找出含有www.dutycode.com的行

find / -name "*.txt" |xargs grep "www.dutycode.com"

统计java文件代码行数

find . -name "*.java"|xargs cat|wc -l 

grep -nr 文件名 文件
-A num, --after-context=num: 在结果中同时输出匹配行之后的num行
-B num, --before-context=num: 在结果中同时输出匹配行之前的num行,有时候我们需要显示几行上下文。
-i, --ignore-case: 忽略大小写
-n, --line-number: 显示行号
-R, -r, --recursive: 递归搜索子目录

-v, --invert-match: 输出没有匹配的行 



猜你喜欢

转载自blog.csdn.net/zlroy1023/article/details/80267484
今日推荐