美文网首页
ADB 常用命令

ADB 常用命令

作者: minehdcxy | 来源:发表于2021-07-04 18:42 被阅读0次

    安装apk

    adb install xxx.apk                安装apk

    adb isntall -r xxx.apk            强制安装apk

    可能会报错,一般导致的原因是所安装的apk的VersionCode小于当前所安装的app的VersionCode, 解决方案卸载正在安装的app在使用命令安装

    卸载apk

    adb uninstall <packageName>

    packageName 为apk包名, 例如 com.xxx.xxx

    模拟用户事件:

    1、文本输入

    adb shell input text <string>

    2、用户点击

    adb shell input tap <x> <y>

    x,y 为坐标左边原点为屏幕左上角

    3、用户滑动

    adb shell input swipe <x1> <y1> <x2> <y2> <time>

    time为时间,单位为毫秒, ps: adb shell input swipe 100 500 500 500 200

    日志获取

    1、adb logcat *:E 输入所有Error日志到终端

    2、adb logcat *:E > xxx.txt 输入日志到xxx文件 ps:adb logcat *:E > ~/Desktop/bug.txt

    3、adb logcat | grep xxx 在日志中过滤字符 输入到日志同上,使用 >

    跑mokey

    adb shell monkey -v -p <packagename> time

    package 为包名 例如 com.xxx.xxx  time为时间

    adb pull push 主要用于文件互传

    adb pull <手机路径>  <本机路径>

    adb push <本机路径>  <手机路径>

    手机路径查看顺序

    1、adb shell

    2、cd 到所在文件的文件夹

    3、pwd 输出文件路径

    4、收到copy

    5、exit 退出adb shell

    6、执行命令

    相关文章

      网友评论

          本文标题:ADB 常用命令

          本文链接:https://www.haomeiwen.com/subject/ymhvultx.html