Skip to main content

Overview

Portal is recommended for local Android control; ADB-only control is also supported. Local iOS uses mobilerun-ios with WebDriverAgent.

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 version
2

Enable USB Debugging

  1. Go to Settings > About phone
  2. Tap Build number 7 times (enables Developer options)
  3. Go to Settings > Developer options
  4. Enable USB debugging
  5. Connect device and tap Always allow
Verify: adb devices
3

Install Portal App (Recommended)

This command:
  • 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
Open Portal once and grant Display over other apps. Grant notification permission, Notification Access, screen-capture consent, and Install unknown apps only when your tasks need those features.To run without Portal, skip this step and set 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
Keep Cloud Connection off for local Framework control. When enabled, Portal connects to the configured server and can send device state, actions, events, and screen-sharing data.For advanced APIs, see the Portal documentation: Local API, Reverse Connection, WebSocket Events, and Triggers and Events.

Communication Modes

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.
Framework configuration:
portal_mode: disabled also bypasses the framework’s automatic Portal setup.
How it works:
  • Portal runs HTTP server on device port 8080
  • ADB forwards local port → device port 8080
  • Mobilerun sends authenticated HTTP requests to localhost:PORT
  • In auto mode, Mobilerun uses the ContentProvider or ADB if HTTP is unavailable
Enable:
Troubleshooting:
How it works:
  • 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
Usage:
Troubleshooting:

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:
Mobilerun handles Portal authentication automatically. Direct WebSocket clients and HTTP calls other than GET /ping must use the token shown in Portal or retrieved through ADB.

Advanced Setup

Setup

1

Enable Wireless Debugging

  1. Settings > Developer options > Wireless debugging
  2. 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:
  1. Tap Pair device with pairing code
  2. Note the pairing code and the pairing-specific IP:port shown in that dialog
  3. Run adb pair IP:PAIRING_PORT
  4. Enter pairing code
Android Studio can alternatively pair by scanning the device’s QR code. The 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
1

Enable TCP/IP Mode (USB Required)

2

Find Device IP

3

Connect Wirelessly

List Devices

Target Specific Device

Parallel Control


Troubleshooting

Symptoms: adb devices shows no devices or unauthorizedSolutions:
  1. Unplug/replug USB cable, try different port
  2. Revoke USB debugging authorizations (Developer options)
  3. Reconnect and tap “Always allow”
  4. Restart ADB: adb kill-server && adb start-server
  5. Windows: Install Google USB Driver
Symptoms: mobilerun ping fails with “Portal is not installed”Solutions:
  1. Reinstall: mobilerun setup
  2. Check: adb shell pm list packages | grep mobilerun
  3. Verify APK architecture matches device (arm64-v8a for most devices)
  4. If Portal is intentionally not used, set device.portal_mode: disabled and validate ADB with adb devices -l instead of mobilerun ping
Symptoms: mobilerun ping fails with “accessibility service not enabled”Solutions:
  1. Auto-enable:
  2. Manual: Settings > Accessibility > Mobilerun Portal > Toggle ON
  3. Verify:
Symptoms: input_text() fails or types gibberishSolutions:
  1. When Portal is available, Mobilerun tries to enable the Portal keyboard when it connects:
  2. Manual switch: Long press space bar → Select “Mobilerun Keyboard”
  3. Focus the element first (tap it), then input text
  4. In ADB-only mode, use printable ASCII; Unicode, control characters, and literal %s are rejected
Symptoms: get_ui_tree() or the formatted agent state is empty or incompleteSolutions:
  1. With Portal enabled, verify its accessibility path with mobilerun ping
  2. In ADB-only mode, inspect adb shell uiautomator dump /dev/tty
  3. Some apps expose incomplete trees (WebViews, games, and custom-rendered UI)
  4. Wait for the UI to settle after a tap or swipe, then request fresh state
  5. With Portal enabled and overlay permission granted, use its overlay for visual debugging

Next Steps