← Back to Chapters

Android Emulator & Device Setup

? Android Emulator & Device Setup

? Quick Overview

To run a React Native app on Android, you need either an Android Emulator or a real Android device. This setup allows developers to test, debug, and preview apps during development.

? Key Concepts

  • Android Studio and SDK installation
  • Android Virtual Device (AVD)
  • USB debugging for physical devices
  • ADB (Android Debug Bridge)
  • Metro bundler communication

? Syntax / Theory

React Native uses the Android SDK to compile and run apps. The react-native run-android command builds the app, installs it on the emulator or device, and starts the app automatically.

? Code Example(s)

? View Code Example
// Command to start Android app on emulator or device
npx react-native run-android
? View Code Example
// Check connected Android devices and emulators
adb devices

? Live Output / Explanation

When the emulator or device is correctly set up, the app launches automatically and displays the default React Native welcome screen. Metro bundler runs in the background to serve JavaScript code.

? Interactive Simulator: The Build Process

Simulate the process of connecting a device and running the build command. Click the buttons in order.

user@dev-machine:~$
(Device Off)
Status: Disconnected

? Use Cases

  • Testing UI on different Android versions
  • Debugging hardware-specific issues
  • Performance testing on real devices
  • Offline and network condition testing

? Tips & Best Practices

  • Use physical devices for real performance testing
  • Keep Android Studio and SDK tools updated
  • Enable hardware acceleration for faster emulators
  • Restart ADB if device is not detected

? Try It Yourself

  1. Install Android Studio and SDK
  2. Create an Android Virtual Device
  3. Run npx react-native run-android
  4. Connect a real device and test the app