Mobile Development 5 min read

Android Monkey Command-Line Tool: Syntax, Parameters, and Usage

The article explains Android's Monkey tool—a command‑line utility for emulator or device testing—detailing its basic syntax, the five categories of options, specific parameters for configuration, event types, constraints, debugging, hidden settings, and how to capture logs.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Android Monkey Command-Line Tool: Syntax, Parameters, and Usage

Monkey is an Android command‑line tool that can run on an emulator or a real device, sending a stream of random events to stress‑test the application under development.

The basic command syntax is adb shell monkey [options] <event-count> , where options are grouped into five categories.

Basic configuration parameters include -help for usage guidance and -v to set the verbosity level (0‑2, default 0).

Event type parameters let you control the mix of generated events, such as -s <seed> for a deterministic seed, -throttle <ms> for delay between events, and percentage flags like -pct-touch , -pct-motion , -pct-trackball , -pct-nav , -pct-majornav , -pct-syskeys , -pct-appswitch , and -pct-anyevent .

Constraint parameters allow you to limit testing to specific packages ( -p ) or intent categories ( -c ).

Debug parameters include -dbg-no-events (launch only), -hprof (performance report), -ignore-crashes , -ignore-timeouts , -ignore-security-exceptions , -kill-process-after-error , -monitor-native-crashes , and -wait-dbg (wait for debugger).

Hidden parameters provide advanced control, such as -pck-blacklist-file<file> and -pck-whitelist-file<file> for package filtering, and -f<script file> to run a custom script.

To capture Monkey’s output, you can redirect it to a file, e.g., adb shell monkey -p com.example.app -v 300 > D:\log.txt .

The article concludes with a brief note about Qtest, the professional testing team of 360, and a reminder to follow their public account for the latest testing technology updates.

mobile developmentAndroidAutomationTestingCommand LineMonkey
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.