Course contentsShow
← React Native
Lesson 111 of 1,5552. Project Scaffolding with ExpoFree lesson

Testing on Real Hardware

Configure USB debugging and wireless testing to validate hardware-dependent features.

In this lesson, you will learn how to bypass the limitations of simulators by configuring your physical device to run your Expo project directly via USB and wireless debugging.

While simulators are great for quick UI checks, they cannot replicate hardware-specific behavior like camera depth-sensing, gyroscope sensitivity, or biometric authentication. To bridge this gap, you need to turn your physical phone into a development environment.

Enabling Developer Mode

Before your computer can "talk" to your device, you must unlock its internal gatekeepers. On both iOS and Android, this involves going into your device Settings. For Android, you’ll navigate to "About Phone" and tap the "Build Number" seven times to unlock Developer Options, where you must toggle on USB Debugging. On iOS, you enable Developer Mode in the Privacy & Security settings.

Connecting the Bridge

Once enabled, the easiest way to bridge the gap is using the expo-dev-client.

  1. Connect your device via USB.
  2. Run npx expo run:android or npx expo run:ios.

By running this command, Expo compiles a development build specifically for your physical hardware. Because you have enabled USB debugging, the CLI will automatically detect your phone as a target device.

Transitioning to Wireless Testing

Tethering your phone to your laptop with a cable is restrictive. Once your development build is installed on your device, you can switch to Wireless Testing. As long as your phone and your development computer are on the same local Wi-Fi network, the Metro bundler will broadcast your code directly to the app.

You can confirm this by opening the Expo Go app (or your custom development client) and checking your terminal output; it will display a QR code. Simply scan that code with your device’s camera to hot-reload your code changes wirelessly. This allows you to test hardware-dependent features, like a flashlight toggle or a shake gesture, while walking around your environment rather than staying glued to your desk.

Key Takeaway: Testing on real hardware requires enabling Developer Mode on your device to create a persistent communication channel with your development environment, allowing you to validate features that simulators simply cannot replicate.