Android下monkey命令参数

adb shell monkey参数:

-v -v -v 日志级别

-s <seed> seed值,相同seed值生成相同的事件序列

--throttle <ms> 时间之间的延迟

--ptc-touch <percent> 触摸时间百分比

--ptc-appswitch <percent> activity切换百分比

-p <allowed-package-name> 限制包

-c <main-category1> -c <main-category2> 限制类

--dgb-no-events 调试模式,只进入到activity,不会生成事件

--hprof 生成profiling report

--ignore-crashes 遇到crash继续执行命令

--ignore-timeouts 遇到超时错误如ANR继续执行命令

--ignore-security-exceptions 遇到权限错误继续执行命令

--kill-process-after-error 出错后通知系统kill进程

--monitor-native-crashes监控native code的崩溃事件并报告

--wait-dbg 暂停执行,直到有调试器连接

ls /data/data |grep xxx 获取包名

logcat | busybox grep START |grep xxx 获取主界面名

-f <test-scripts>执行monkey脚本

monkey脚本示例 adb push monkeytest /mnt/sdcardadb shell monkey -v -v -v -f /mnt/sdcard/monkeytest 10 10为循环次数

# Start Script
type = user
count = 10
speed = 1.0
start data >> 
LaunchActivity(String pkg_name, String cl_name,long alarmTime) 
UserWait(5000)
...
原文地址:https://www.cnblogs.com/quxiaozha/p/9934570.html