adb命令连接模拟器


  • 安装好SDK
  • 环境变量配置好
  • 安装模拟器
  • 模拟器设置开发者模式
  • 开发者模式中设置允许USB调试
  • 找到电脑版模拟器的安装路径,我这里以夜神模拟器为主,找到bin目录使用cmd运行nox_adb.exe connect 127.0.0.1:62001(62001为模拟器对应的端口号)
  •  
  • 再次输入:adb devices 列表中找到对应模拟器表面连接成功
  • 查看当前包名
  • adb shell dumpsys activity activities | findstr mResumedActivity
  • monkey事件简介1-10共11
  • --pct-touch 触摸事件 触摸事件是指在屏幕某处按下并抬起的操作 例如触摸事件80 --pct-touch 80
  • --pct-motion 手势事件是指在屏幕某处的按下、随机移动、抬起的操作,即直线滑动操作。
  • 0:触摸事件百分比,参数--pct-touch
  • 1:滑动事件百分比,参数--pct-motion
  • 2:缩放事件百分比,参数--pct-pinchzoom
  • 3:轨迹球事件百分比,参数--pct-trackball
  • 4:屏幕旋转事件百分比,参数--pct-rotation
  • 5:暂时不知道这个是什么 ------
  • 6:基本导航事件百分比,参数--pct-nav
  • 7:主要导航事件百分比,参数--pct-majornav
  • 8:系统事件百分比,参数--pct-syskeys
  • 9:Activity启动事件百分比,参数--pct-appswitch
  • 10:键盘翻转事件百分比,参数--pct-flip
  • 11:其他事件百分比,参数--pct-anyevent
  • 对指定包名做出时间操作,跑完monkey之后的log日志保存在你的txt文件里!
  • adb shell monkey -puni.UNI937812312333BE406 --throttle 100 -v 20000 >D:/monkey/a.txt
  • 停止monkey操作
  • adb shell进入androidlinux命令
  • ps |grep monkey
  • kill 操作步骤左边第二个,root后面第一个数字 ,例如 kill 3401