crewdroid
v0.2.7Light Android emulators for AI agents: text screen outline, per-device network, battery, location.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
devices
Use to find the emulator-<port> serial every other tool needs, or to check what is already running. Returns [{serial, avd, api, profile, screen, cores, ramMB, booted}]; empty = call up.
up
Start of the loop: boot headless emulators (1-3 min). No args = ONE device (s24ultra, newest API <= 36), the right choice for building/checking an app; count > 1 mixes Galaxy profiles and Android versions. How many: 1 to build/check an app; 2-3 to reproduce multi-user bugs (duplicate / lost / overwritten records); one per screen or Android version you must check (or name them with profiles). Each device takes about 1.5 GB of host RAM; a count the available RAM cannot hold fails before booting and says how many fit. Returns {devices:[{serial, api, profile, wmSize}]}; pass serial to every other…
| Parameter | Type | Description |
|---|---|---|
allowNoHelper | boolean | true = keep the devices when the on-device helper fails (screen/tap/type then use the slower uiautomator/input) |
api | integer | pin the image API, e.g. 31|34|36 |
basePort | integer | |
cores | integer | guest CPUs, e.g. 1|2|4|6|8 (default 2; <= host CPUs) |
count | integer | |
idleMinutes | integer | devices stop after this many minutes without a crewdroid call, and when this MCP server exits (default 60; 0 = never) |
load | string | used-phone load applied after boot (see the load tool) |
profiles | array | profile names from profiles/galaxy.json |
ram | integer | guest RAM MB, 896..8192 (default 896, API 31 768) |
timeoutSec | integer | |
wifi | boolean | true = each device can get its own Wi-Fi address (31 of 33 measured device boots; default: one device at a time; +9.4 % idle RAM) |
down
End of the loop: kill every crewdroid (crew-*) emulator. Always call it when finished. Returns {killed: pids, ports}.
net
Set one emulator's network state (airplane|nodata|slow|flaky|online), which link is up (wifi|cellular|both|none), switch the active link while traffic flows (handover), or mark Wi-Fi metered. Returns the transport apps see: {default: wifi|cellular|none, connected, metered}.
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
state * | string | |
during | integer | handover: ms with no link between old and new (default 0 = new link up before the old one goes) |
metered | boolean | state=metered: true = Wi-Fi metered |
seed | integer | |
to | string | handover target (default: the other link) |
judge
Judge server data (unique / count / noLostUpdate) and/or a proxy request log (dupSuccess / lostUpdate / lostWrite / idle) against a rules file. ok=false lists violations.
| Parameter | Type | Description |
|---|---|---|
log | string | proxy JSONL log (proxy tool / run with proxy), e.g. with judge/proxy.rules.json |
rules | string | |
source | string | server base URL (GETs /export) or JSON file |
hammer
Virtual users hit a server API concurrently, then judge the result.
| Parameter | Type | Description |
|---|---|---|
url * | string | |
jitter | number | |
repeat | integer | |
retryRate | number | |
rules | string | |
seed | integer | |
users | integer |
run
Run a multi-device scenario on any app: up, install, per-device actions (Maestro flow / intent / adb) + network schedule, drain, judge (proxy log by default), down (minutes). Give `file` (scenario JSON, docs/guide-your-app.md) OR, with no file, apk + flows + server (setupFlow, count, repeat, network optional).
| Parameter | Type | Description |
|---|---|---|
apk | string | no-file form: your APK (package read from it) |
basePort | integer | |
count | integer | default: the file's devices.count, else 3 |
file | string | scenario JSON, e.g. scenarios/photo-upload.json; omit to use apk/flows/server |
flows | array | no-file form: Maestro flows run in order every iteration |
network | boolean | no-file form: false = no network faults (default: all four states) |
repeat | integer | no-file form: iterations per device (default 5) |
seed | integer | |
server | string | no-file form: backend as the host sees it, http://host:port |
serverPort | integer | |
setupFlow | string | no-file form: Maestro flow run once per device first |
timeoutSec | integer |
apk
Read an APK's manifest on the host (aapt2): package, version, min/target SDK, permissions, exported activities, deep-link filters.
| Parameter | Type | Description |
|---|---|---|
file * | string | path to the .apk on the host |
app
Control an app on a crewdroid emulator: perm grant|revoke|show [perm…], open <uri> (deep link / App Link), links show|force <domain>|reset (API 31+), clear, backup, restore (LocalTransport), pressure doze|standby <active|working_set|frequent|rare|restricted>|trim <level>|bg-restrict|battery-saver|reset, fill-storage <GB>|free. Setters read the state back and error on mismatch.
| Parameter | Type | Description |
|---|---|---|
pkg * | string | application id, e.g. dev.crewdroid.probe |
serial * | string | emulator-<port> |
what * | string | |
args | array | |
onlyThisPackage | boolean | open only: restrict the intent to pkg |
install
Use after each build: adb install -r [-g] a host .apk on one emulator or `all` crew devices (replaces the old version, keeps data). Returns ok and per device package + Success or the adb failure code (INSTALL_FAILED_*).
| Parameter | Type | Description |
|---|---|---|
apk * | string | host path to the .apk |
target * | string | emulator-<port> or all |
grant | boolean | -g: grant all runtime permissions |
launch
Use to open the app after install, or restart it (restart:true) after a change. am start -W, then checks the process 2 s later. Returns component, totalTime ms and crashed; crashed:true comes with crash {exception, topFrame} (then call logs or triage).
| Parameter | Type | Description |
|---|---|---|
pkg * | string | |
serial * | string | emulator-<port> |
activity | string | e.g. .MainActivity; default = launcher activity |
extras | array | am start extras, e.g. ["--es","check","crash"] |
restart | boolean |
logs
Use to see what the app printed or why it failed: one app's logcat lines only (its pid; its last pid when not running). Default: the last 40 lines at level >= I, one text line each `HH:MM:SS.mmm L Tag: message`, equal lines in a row folded `(xN)`, stack traces cut to the top 8 app frames. all:true = today's whole output at level V (max 500 lines); since:"1m" limits to recent lines; format:"json" = {lines:[{time, level, tag, message}]}.
| Parameter | Type | Description |
|---|---|---|
pkg * | string | |
serial * | string | emulator-<port> |
all | boolean | |
format | string | |
level | string | default I (V with all) |
seconds | integer | follow for N s |
since | string | 60s | 90 | 2m |
env
Change or read a crewdroid emulator's environment: geo <lon> <lat> [alt], battery <0-100> [ac|unplugged], rotate <0-3>, sensor acceleration x:y:z, dark on|off, font <scale>, locale <pkg> <tags> (API 33+), gsm data <home|roaming|searching|denied|off|on>, gsm signal <0-31>, sms <from> <text>, call <number> [accept|cancel], show. Every setter reads the state back and errors on mismatch.
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
what * | string | |
args | array | |
holdSeconds | integer | gsm signal only: keep re-sending for this long |
fold
Fold (cover screen) or unfold (main screen) a fold/flip-profile emulator: the app gets a configuration change with the new size. No hinge/posture emulation on ATD.
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
to * | string | cover = folded, main = unfolded |
tap
Use to press a button or field: by text/content-desc (text), resource-id (id), a point x,y, or index alone = the [n] line of the last screen outline (no new tree read while that window still has focus). Element match = exact first, then case-insensitive contains. 0 or several matches (text/id without index) fail and list the candidates; retry with index (0-based among the matches) or id. Returns the tapped point and the new screen outline once it settled (screen:false to skip), so no separate screen call is needed.
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
format | string | |
id | string | resource-id, full or the part after :id/ |
index | integer | alone: [n] of the last screen; with text/id: 0-based among the matches |
screen | boolean | false = do not return the new screen |
text | string | |
x | integer | |
y | integer |
type
Use to fill a text field: appends any text (Korean, emoji included) to the focused field through the on-device helper; into = text or resource-id of the field to tap first. Returns the field typed into and the new screen outline (screen:false to skip). Without the helper it falls back to `input text`, where non-ASCII fails with the reason.
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
text * | string | |
format | string | |
into | string | |
screen | boolean | false = do not return the new screen |
swipe
Use to scroll or page: swipe up|down|left|right (finger direction, middle 50 % of the screen; up scrolls content down) `times` times, or a line x1,y1 -> x2,y2 in ms. Returns the from/to points and the new screen outline (screen:false to skip).
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
direction | string | |
format | string | |
line | array | [x1,y1,x2,y2] |
ms | integer | |
screen | boolean | false = do not return the new screen |
times | integer |
key
Use for navigation and hardware keys: back|home|enter|delete|tab|menu or any KEYCODE_*. Returns the focused window and the new screen outline (screen:false to skip).
| Parameter | Type | Description |
|---|---|---|
key * | string | |
serial * | string | emulator-<port> |
format | string | |
screen | boolean | false = do not return the new screen |
layout
Use to find broken screens of any installed app across Galaxy screens x font sizes on ONE device (default 5 profiles x fonts 1.0/1.3/2.0 = 15 combos, ~2-4 min). Per combo the app is restarted and the launch activity (or the screen a Maestro flow reaches) is judged from the accessibility tree: wrap (button label on 2+ lines, word broken), clip (ellipsized/cut text), offscreen (no scroll can reach it), overlap (> 20 %), target (< 48 dp). Returns {ok, combos:[{profile, font, ok, findings:[{kind, text|id, bounds, detail}], png?}], summary}; png = screenshot with the finding boxes drawn. The device…
| Parameter | Type | Description |
|---|---|---|
pkg * | string | installed package |
serial * | string | emulator-<port> |
activity | string | e.g. .MainActivity; default = launcher activity |
extras | array | am start extras, e.g. ["--es","check","layout-bad"] |
flow | string | Maestro flow (host path) run after each start; the screen it ends on is judged |
fonts | array | font scales, default [1.0,1.3,2.0] |
out | string | directory for the PNGs (default ./crewdroid-layout-<pkg>-<time>) |
profiles | array | profile names, default s24ultra,fold5-cover,fold5-main,flip6-cover,trifold-main |
timeoutSec | integer |
load
Make one emulator behave like a used phone: off|low|mid|high = installed filler apps (30/80/150), background processes (5/15/30), memory ballast down to 50/30/15 % of the off-level free RAM, CPU workers at 10/25/50 % per core, alarm/job wakeups. off removes it all (keepApps keeps the fillers installed). Returns the measured guest state (MemAvailable %, load average, CPU busy %, processes, packages).
| Parameter | Type | Description |
|---|---|---|
level * | string | |
serial * | string | emulator-<port> |
keepApps | boolean | off only: keep the filler packages installed |
timeoutSec | integer |
perf
Cold start time (force-stop, 2 s, am start -W), frames/jank %/p50-p99 (gfxinfo) and PSS java/native (meminfo) of one app. ATD has no GPU: compare frame numbers relatively.
| Parameter | Type | Description |
|---|---|---|
pkg * | string | |
serial * | string | emulator-<port> |
activity | string | e.g. .MainActivity; default = launcher activity |
extras | array | am start extras, e.g. ["--es","check","jank"] |
proxy
Recording HTTP proxy between the emulators and your server (no app or server change): action start points every device's system proxy at it (10.0.2.2:<port+k>), stop clears it, log returns the request log. Judge the log with the judge tool's `log` input (dupSuccess / lostUpdate / lostWrite / idle).
| Parameter | Type | Description |
|---|---|---|
action * | string | |
devices | array | default: every running crew emulator |
log | string | JSONL path |
loseAcks | number | fault injection: share of writes whose answer is dropped after the server committed them |
port | integer | |
target | string | start: server base URL as seen from the host, e.g. http://127.0.0.1:5599 |
screen
Use to READ the screen before tap/type (tree, not pixels). Default: a short outline, first line = focused window and size, then one line per visible element `[n] role "text" #id @x,y flags` (role btn/edit/text/img/list/check; a card's texts sit on its one line; `… N more below (swipe up)` = off-screen). tap {index:n} alone taps [n] of this outline. format:"json" = full tree {focus, nodes[{cls,text,desc,id,bounds,clickable,depth,...}], via}. While a Maestro flow runs the tree is empty and a line says why. For how it looks, use shot. On API 31 a black screen after a relaunch (emulator bug, ADR…
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
bounds | boolean | add [l,t,r,b] to each line |
format | string | |
png | string | host path for a screenshot |
setup
Use first on a new machine, or when up fails for a missing SDK/image: checks/installs the Android SDK pieces crewdroid needs (JDK 17 for sdkmanager, command-line tools, platform-tools, emulator, google_atd images). Dry run by default: returns steps [{step, status: present|missing, downloadBytes}]; yes:true installs and accepts the SDK licences.
| Parameter | Type | Description |
|---|---|---|
images | array | Android API levels of google_atd images, default ["34"] |
only | array | limit to these steps |
sdk | string | SDK directory (default ANDROID_SDK_ROOT / ANDROID_HOME, else ~/.crewdroid/android-sdk) |
yes | boolean | install for real and accept the SDK licences |
shot
Use to SEE the screen (pixels: layout, colours, clipping). Returns an image item (PNG, also saved to file or ./crewdroid-<serial>-<time>.png) and a text line with path and size. To find a button or text to tap, use screen instead. On API 31 a fully black screen after an app relaunch (emulator bug, ADR 0005) is recovered first.
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
file | string | host path for the PNG |
triage
Why did the app die? Crashes (logcat crash buffer), ANRs (ActivityManager log, exit-info, /data/anr traces), exit reasons, the app's last 200 log lines, optional heap dump.
| Parameter | Type | Description |
|---|---|---|
serial * | string | emulator-<port> |
app | string | package name, e.g. dev.crewdroid.probe |
heap | string | host path for an .hprof (needs app running) |