ADB常用命令

作者: black_toast | 来源:发表于2018-04-15 09:45 被阅读12次

    查看设备

    adb devices 
    

    开启/关闭adb服务

    adb start-server 
    adb kill-server 
    

    连接/断开设备(这个会在三星在线机型测试使用到/wifi调试时使用到-->三星远程开发测试平台

    // 使用在线调试
    adb tcpip 5555 // 设置调试端口号
    adb connect ip  // 链接ip设备
    adb disconnect ip   // 取消链接ip设备
    
    // 使用usb调试
    adb usb // 使用usb调试
    ip为可以访问到的设备ip
    

    安装apk

    adb install -t ***.apk
    

    查看已安装的应用

    adb shell pm list packages  // 查看所有应用
    adb shell pm list packages -s   // 查看系统应用
    adb shell pm list packages -3   // 查看三方应用
    

    启动应用

    adb shell am start -n 包名/相对包名的类名
    如:adb shell am start -n com.example.test/.MainActivity
    

    文件传输

    pull:获取文件
    adb pull 要获取的文件路径 存储的文件路径
    push:上传文件
    adb push 要上传的文件路径 存储的文件路径
    

    查看日志输出

    adb logcat
    

    查看屏幕分辨率

    adb shell wm size
    

    查看当前聚焦Activity类名

    Linux系统
    adb shell dumpsys activity | grep "mFocusedActivity"
    
    Windows系统
    adb shell dumpsys activity | findstr "mFocusedActivity"
    

    模拟屏幕点击(实现微信跳一跳高分核心方法)

    adb shell input touchscreen swipe x1 y1 x2 y2 time
    x1:起始点击点的x位置
    y1:起始点击点的y位置
    x2:终止点击点的x位置
    y2:终止点击点的y位置
    time:操作耗时毫秒数
    

    截屏(实现微信跳一跳高分核心方法)

    adb shell screencap -p 文件输出路径
    

    相关文章

      网友评论

        本文标题:ADB常用命令

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