UiAutomator2 Setup Workflow
Routing
Use this Skill to prepare or repair UiAutomator2 prerequisites selected by
skills/setup/SKILL.md or handed off by
skills/appium-troubleshooting/SKILL.md. After required setup checks pass,
route an existing UiAutomator2 session or command failure back to
skills/appium-troubleshooting/SKILL.md. Load FFmpeg or bundletool only when
the user explicitly requested that capability.
Required inputs
Confirm Android as the target, global appium mode or explicitly requested
local npx appium mode, host OS, device or emulator expectations, permissions,
and optional dependency requests.
Workflow
- Load the global command profile by default or the local profile only when explicitly requested.
- Load the Android profile, shared Appium setup basics, and Android emulator setup Context.
- Load the UiAutomator2 decision, installation, doctor, and smoke references in that order.
- Run
node tools/appium/setup/scripts/check-uiautomator2-env.mjs --format summary --report auto; add--appium-mode localonly for explicitly requested local mode. Verifysummary.requiredOk: true,summary.driverInstalled: true, a populatedsummary.driverVersion, andsummary.doctorRequiredOk: true. Apply required fixes in technical dependency order and rerun affected checks. If the gate remains unresolved, reportblockedwith evidence and the next action. Load the matching example only when needed. - Verify the direct doctor output reports
0 required fixes neededusingappium driver doctor uiautomator2, ornpx --no-install appium driver doctor uiautomator2in local mode. - Run
node tools/appium/setup/scripts/smoke-appium-server.mjs --driver uiautomator2 --report auto; add--appium-mode localonly in local mode. Requiresummary.requiredOk: truefor server readiness, driver evidence, and cleanup. The smoke reference documents target-specific options.
UiAutomator2 setup safety and approval constraints
- Preserve the selected command mode throughout the workflow.
- Ask before optional FFmpeg or bundletool setup, privileged commands, SDK license changes, or emulator creation that changes local state.
- Preserve working Java, Android SDK, device, emulator, and driver installations.
Completion criteria
- Android environment completion criteria pass.
- Appium succeeds in the selected command mode.
- The installed driver list includes
uiautomator2. appium driver doctor uiautomator2reports0 required fixes needed; optional warnings are non-blocking./statussucceeds, server logs listuiautomator2, and the server started for verification has exited.
Evidence boundary
Report Appium and UiAutomator2 versions, helper requiredOk, Android
prerequisite summary, doctor required/optional summary, /status, server
driver evidence, cleanup, and explicitly requested optional capability results.
Self-Improvement Prompt
Before the final response, report any missing, ambiguous, outdated, or retry-causing UiAutomator2 setup instruction with its asset path and proposed wording. Leave unrelated assets unchanged.


