常用adb 相关知识整理

2018-12-29  本文已影响0人  柠檬萌呀

1.安装apk :

     adb install <apk路径>

2. 卸载apk:

    adb uninstall <包名>

    adb uninstall –k  <包名>       //其中 -k 参数为卸载软件时保留配置和缓存文件

3. 截图并保存到电脑:

    adb shell screencap -p /sdcard/01.png

    adb pull /sdcard/01.png

4. 清缓存:

    adb shell pm clear <包名>

5.模拟按键

  adb shell input keyevent <key>

例如最常用的一些:

//这条命令相当于按了设备的Backkey键

adb shell input keyevent 4

 //可以解锁屏幕

adb shell input keyevent  82 

//在屏幕上做划屏操作,前四个数为坐标点,后面是滑动的时间(单位毫秒)

adb shell input swipe 50 250 250 250 500 

//在屏幕上点击坐标点x=50  y=250的位置。

adb shell input tap 50 250 

//输入字符abc

adb shell input text abc

参考链接:https://www.cnblogs.com/chengchengla1990/p/4515108.html

6.推出ANR日志

adb pull /data/anr/traces.txt

7.打印日志并输出到电脑

adb logcat >F:/log.log

参考文章

上一篇 下一篇

猜你喜欢

热点阅读