← All posts

Detox E2E Tests on a Real Cloud Android Phone (React Native)

Oct 22, 2026 · By Xavier Fok

Detox is the gray-box end-to-end test runner most React Native teams reach for. It syncs with your app instead of guessing at sleeps, so tests are fast and far less flaky than a black-box tool. The default tutorial points you at an emulator, which is fine for CI volume. But some bugs only show up on a real phone on a real network, and Detox runs against a real device just as happily.

I run a farm of real Android phones in Singapore, reachable over ADB, so this post is the practical version: how to point Detox at a real cloud phone, the gotchas that bite, and where it actually pays off.

why bother with a real device for Detox

Most of your Detox runs should stay on an emulator. It is faster and cheaper for CI. Use a real device when the test depends on something an emulator fakes:

  • real mobile network latency and offline handling
  • real camera, GPS, or sensor flows
  • performance and animation jank on real silicon
  • any SDK that detects emulators (some payment and social SDKs change behaviour)

If none of that applies, stay on the emulator. No shame in it.

how Detox finds a device

Detox does not care whether a device is local or in a rack across the world. It talks to whatever adb devices shows. So the whole trick is getting the cloud phone to appear in your local ADB, then telling Detox to use it.

Connect to the cloud phone over ADB. With cloudf.one you adb connect to the device endpoint:

adb connect <phone-host>:<port>
adb devices
# List of devices attached
# 100.x.y.z:5555   device

Once it shows as device, Detox can target it.

configure Detox to use an attached device

Detox 20 uses .detoxrc.js. Add a device of type android.attached and reference its adbName, then wire it into a configuration. The adbName is exactly what adb devices prints.

// .detoxrc.js
module.exports = {
  testRunner: {
    args: { $0: 'jest', config: 'e2e/jest.config.js' },
  },
  apps: {
    'android.release': {
      type: 'android.apk',
      binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
      testBinaryPath:
        'android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk',
      build:
        'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release',
    },
  },
  devices: {
    'cloud.attached': {
      type: 'android.attached',
      device: {
        // must match `adb devices` exactly
        adbName: '100.x.y.z:5555',
      },
    },
  },
  configurations: {
    'android.cloud.release': {
      device: 'cloud.attached',
      app: 'android.release',
    },
  },
};

A regex also works for adbName if the host or port varies, for example adbName: '.*:5555', but pin it to the exact value when you can so Detox never grabs the wrong device.

build, then run against the cloud phone

Build the APK and the test APK once, then run the cloud configuration:

# build the app + androidTest APKs
detox build --configuration android.cloud.release

# run the suite against the attached cloud phone
detox test --configuration android.cloud.release

Detox installs both APKs onto the cloud device over ADB, launches your app, and drives it. You watch the run stream in your terminal exactly as you would with a local device.

the gotchas that will bite you

These are the ones that cost me time, so learn them cheaply.

1. adbName must match exactly. If adb devices prints 100.x.y.z:5555, that is the string Detox needs. A typo or a stale port gives you Could not find a connected device even though ADB sees it. Always copy it from adb devices rather than typing it.

2. release build for E2E, not debug. Run E2E against a release or a testBuildType build. Debug builds bundle the Metro dev server and Detox can hang waiting on the packager. The config above builds assembleRelease assembleAndroidTest for this reason.

3. test APK signing. The app APK and the androidTest APK must be signed with the same key, or the install fails with INSTALL_FAILED_UPDATE_INCOMPATIBLE. If you swap signing configs between builds, uninstall first: adb -s <adbName> uninstall <your.package> and adb -s <adbName> uninstall <your.package>.test.

4. network latency to the device. A cloud phone is further away than localhost, so ADB commands have more round-trip time. Detox’s sync engine handles this, but bump the launch timeout if installs are slow. In your init, give it room:

// e2e/init.js or beforeAll
await device.launchApp({ newInstance: true, launchArgs: { detoxPrintBusyIdleResources: 'YES' } });

If installs time out on a slow link, set DETOX_DEFAULT_LAUNCH_APP_TIMEOUT higher or pre-install the APK with adb install -r before the run.

5. one suite per device at a time. A single physical phone runs one Detox worker. Keep --maxWorkers 1 for that device. To parallelize, connect several phones and shard across their adbNames, one worker each.

6. keep the ADB connection alive. Over a long suite a flaky link can drop the adb connect. If you see device offline mid-run, reconnect with adb connect <host>:<port> and consider a keepalive. On cloudf.one the device endpoint is stable, but your own network between you and it is what usually wobbles.

a minimal test to confirm the wiring

Before trusting a full suite, run one trivial test to prove the device, build, and Detox all agree:

// e2e/smoke.test.js
describe('smoke', () => {
  beforeAll(async () => {
    await device.launchApp({ newInstance: true });
  });

  it('shows the home screen', async () => {
    await expect(element(by.id('home-screen'))).toBeVisible();
  });
});

If that passes on the cloud phone, your real network and real device are in the loop and the rest of your suite will run the same way, just slower than localhost and far more honest about production.

where this pays off

The bugs Detox catches on a real cloud phone that it would never catch on an emulator are the network and integration ones. A retry that loops forever on real mobile latency. A login SDK that behaves differently because it detected the emulator. An animation that drops frames on real silicon. These are exactly the failures that reach production from an all-emulator pipeline.

cloudf.one gives you that real Android phone in Singapore over ADB, on a real SG carrier IP, without running a device lab. Point Detox at it like any attached device and your E2E suite tests what your users actually hit.

There is a free trial on the cloudf.one home page if you want to adb connect and run a suite yourself. Use code YT30 if you came from the channel.

frequently asked questions

does Detox support real Android devices? yes. use device type android.attached and set adbName to whatever adb devices shows. Detox does not care if the device is local or remote.

can I run my existing emulator suite on the cloud phone unchanged? mostly. the tests stay the same. you add an attached-device configuration and run a release build instead of debug, then expect slower installs because of network latency.

how do I parallelize across cloud phones? connect several phones over ADB, give each its own attached-device config or a regex adbName, and shard your Jest tests across them with one worker per device.

why is the install slow compared to my emulator? the APK travels over the network to the device instead of staying on localhost. raise the launch timeout or pre-install the APK with adb install -r before the Detox run.

Get new guides and videos first — join the Telegram channel.

40% off until 31 December 2026
Real phones in Singapore, each with its own mobile IP.
Introductory price until 31 December 2026. A dedicated phone straight away, no queue.