Skip to main content
Docs
Blog Status Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Emulator sessions

You can use the ew-cli start-session command to start an interactive emulator session - this will start the emulator and connect it to your local adb. After adb is connected, you can use a 3rd party tool like scrcpy to get an interactive emulator window.

The emulator will be stopped when you hit the specified time limit or when you exit the CLI session with Ctrl+C.

Quick start

Run ew-cli start-session with your API token to obtain a device and connect it to your local adb server:

ew-cli --token YOUR_API_TOKEN start-session

Alternatively, pass your API token in via the EW_API_TOKEN env var:

export EW_API_TOKEN="YOUR_API_TOKEN"
ew-cli start-session

Run with --help to see all the possible options:

ew-cli start-session --help

Common examples

Set the maximum session duration value

Use --max-time-limit to automatically cancel the session when a time limit is hit:

ew-cli start-session --max-time-limit 15m

Launch multiple emulator sessions in parallel

Repeat --device arguments to get multiple emulator sessions in parallel, for instance to test your app on an old device, a phone and a tablet at the same time:

ew-cli start-session --device model=Pixel2,version=27 --device model=Pixel7,version=37 \
  --device model=Tablet10,version=37

Capture a video of the full session

Use --record-video to record the full session video. Add --outputs and --outputs-dir to automatically download it at the session end. The file will end up in my-session/recording.mp4

ew-cli start-session --record-video --outputs captured_video --outputs-dir my-session

Options reference

Authentication

--token

Your API token. Can alternatively use the EW_API_TOKEN environment variable to pass this in.


Session configuration

--device

Specify device(s) for the session, use repeated values to obtain multiple devices. Possible keys:

  • model - the device profile to use (list of supported models)
  • version - the API version to use (list of supported versions)
  • locale - device locale to use (default: en_US)
  • gpu - control if the emulator should use hardware-accelerated GPU (default: auto). Possible values:
    • auto: use hardware-accelerated GPU if available
    • software: use software rendering

--max-time-limit

Max time until this session is cancelled, expressed by a number followed by a unit (h, m or s), with the maximum value being 8h and the minimum value being 60s.


--adb

Will automatically connect/disconnect the adb-server to the locally forwarded adb port.

Use --no-adb to disable the default behaviour and manage the adb connection manually.


--adb-binary

Path to the adb binary to use. If not specified, ew-cli will try to discover it in the ANDROID_HOME or ANDROID_SDK_ROOT environment variables, or on the PATH.


--record-video

Enable recording video during the session. Use --no-record-video to disable recording.


--outputs

Specifies what to download into the path specified by --outputs-dir.

Available options:

  • captured_video - captured test video, separate per emulator instance in the session

--outputs-dir

Path to collect session outputs to. Currently only video is stored as an output.


Emulator networking

--dns-server [ipv4-address]

IPv4 address of a DNS server to use for the emulator. This argument can be repeated multiple times (up to 4) to specify multiple DNS servers. Can be used together with --egress-tunnel to use DNS servers otherwise not visible to the emulator.

If omitted emulator.wtf will use an unspecified public DNS service by default.


--dns-override [host]=[ipv4-address]

Explicitly override DNS records used by the emulator. Useful for instance with --egress-localhost-fwd-ip to divert traffic going to a specific domain into the host machine running ew-cli instead. Can be repeated to override multiple domain resolutions.


--egress-tunnel

Redirects all network traffic from the emulator instance to ew-cli as if you were running the emulator locally. You can use this to test your app with a local server or an internal environment only accessible to your local machine or CI runner.

Read more about the egress tunnel here.


--egress-localhost-fwd-ip [ipv4-address]

Makes ew-cli’s localhost available to the emulator instance under the specified IP address when using the egress tunnel. This is useful for testing local servers. NOTE: this should NOT be a public IP, loopback IP or a broadcast IP address.


CLI networking

--proxy-host

Configure an HTTP proxy host to use for all requests.


--proxy-port

Configure an HTTP proxy port to use for all requests.


--proxy-user

Set the HTTP proxy username to use for authentication.


--proxy-password

Set the HTTP proxy password to use for authentication.


CLI execution

--json

Print machine-readable session events into STDOUT, useful when wrapping ew-cli with your own scripts.