Overview
Portal is recommended for local Android control; ADB-only control is also supported. Local iOS usesmobilerun-ios with WebDriverAgent.
- Android Setup
- iOS Setup
Prerequisites
Portal requires Android 8.0 (API 26) or newer. ADB-only setup requires ADB and UIAutomator.1
Install ADB
macOS:
brew install android-platform-toolsLinux: sudo apt install adbWindows: Download from Android Developer SiteVerify: adb version2
Enable USB Debugging
- Go to Settings > About phone
- Tap Build number 7 times (enables Developer options)
- Go to Settings > Developer options
- Enable USB debugging
- Connect device and tap Always allow
adb devices3
Install Portal App (Recommended)
- Downloads the compatible Portal APK
- Installs or upgrades the APK and grants the Android permissions allowed during installation
- Enables its accessibility service or opens Android Settings for approval
device.portal_mode: disabled in the framework configuration.4
Verify Setup
mobilerun ping checks Portal. For ADB-only setup, use adb devices -l or adb -s SERIAL get-state.Portal App
The Mobilerun Portal (com.mobilerun.portal) provides:- Accessibility Tree - Extracts UI elements and their properties
- Device State - Tracks current activity, keyboard visibility
- Action Execution - Tap, swipe, text input, and other actions
- Local Control - HTTP, WebSocket, and ADB interfaces
- Cloud Connection - Optional remote control and screen streaming
- Events and Triggers - Optional device events and trigger rules
Communication Modes
ADB-only mode
ADB-only mode
How it works:
- Tap, swipe, buttons, app lifecycle, packages, install/uninstall, screenshots, and date use ADB.
- UI state comes from UIAutomator.
- Text uses Android’s ADB input command and is limited to printable ASCII; Portal is needed for reliable Unicode input.
portal_mode: disabled also bypasses the framework’s automatic Portal setup.Portal over TCP
Portal over TCP
How it works:Troubleshooting:
- Portal runs HTTP server on device port 8080
- ADB forwards local port → device port 8080
- Mobilerun sends authenticated HTTP requests to
localhost:PORT - In
automode, Mobilerun uses the ContentProvider or ADB if HTTP is unavailable
Portal ContentProvider mode
Portal ContentProvider mode
How it works:Troubleshooting:
- Portal exposes content provider at
content://com.mobilerun.portal/ - Commands sent via ADB shell:
content query --uri ... - JSON responses parsed from shell output
- Authentication is handled through ADB
Portal policy (portal_mode)
auto_setup=True installs or repairs Portal before connecting. Set it to False to skip that step.Local HTTP and WebSocket authentication
Portal generates a bearer token for direct local HTTP and WebSocket clients. Copy it from the Portal main screen or retrieve it over ADB:GET /ping must use the token shown in Portal or retrieved through ADB.Advanced Setup
Wireless Debugging (Android 11+)
Wireless Debugging (Android 11+)
Setup
1
Enable Wireless Debugging
- Settings > Developer options > Wireless debugging
- Note the IP address and debugging port shown on the main Wireless debugging screen (for example,
192.168.1.100:37757)
2
Pair Device (First Time)
Pairing Code Method:
- Tap Pair device with pairing code
- Note the pairing code and the pairing-specific IP:port shown in that dialog
- Run
adb pair IP:PAIRING_PORT - Enter pairing code
adb pair CLI expects an address/port and pairing code, not the QR payload.3
Connect
Common Issues
- Connection refused → Check same WiFi network and firewall
- Frequent drops → Use 5GHz WiFi or stay near router
- Can’t find IP → Run
adb shell ip addr show wlan0 | grep "inet "via USB
Wireless Debugging (Android 10 and Below)
Wireless Debugging (Android 10 and Below)
1
Enable TCP/IP Mode (USB Required)
2
Find Device IP
3
Connect Wirelessly
Troubleshooting
Device not found
Device not found
Symptoms:
adb devices shows no devices or unauthorizedSolutions:- Unplug/replug USB cable, try different port
- Revoke USB debugging authorizations (Developer options)
- Reconnect and tap “Always allow”
- Restart ADB:
adb kill-server && adb start-server - Windows: Install Google USB Driver
Portal not installed
Portal not installed
Symptoms:
mobilerun ping fails with “Portal is not installed”Solutions:- Reinstall:
mobilerun setup - Check:
adb shell pm list packages | grep mobilerun - Verify APK architecture matches device (arm64-v8a for most devices)
- If Portal is intentionally not used, set
device.portal_mode: disabledand validate ADB withadb devices -linstead ofmobilerun ping
Accessibility service not enabled
Accessibility service not enabled
Symptoms:
mobilerun ping fails with “accessibility service not enabled”Solutions:- Auto-enable:
- Manual: Settings > Accessibility > Mobilerun Portal > Toggle ON
- Verify:
Text input not working
Text input not working
Symptoms:
input_text() fails or types gibberishSolutions:- When Portal is available, Mobilerun tries to enable the Portal keyboard when it connects:
- Manual switch: Long press space bar → Select “Mobilerun Keyboard”
- Focus the element first (tap it), then input text
- In ADB-only mode, use printable ASCII; Unicode, control characters, and literal
%sare rejected
Empty UI state
Empty UI state
Symptoms:
get_ui_tree() or the formatted agent state is empty or incompleteSolutions:- With Portal enabled, verify its accessibility path with
mobilerun ping - In ADB-only mode, inspect
adb shell uiautomator dump /dev/tty - Some apps expose incomplete trees (WebViews, games, and custom-rendered UI)
- Wait for the UI to settle after a tap or swipe, then request fresh state
- With Portal enabled and overlay permission granted, use its overlay for visual debugging
Next Steps
- Learn about the Agent System
- Explore Configuration Options
- Try Custom Tools
- Implement Structured Output