run-android command builds your Android app and runs it on a connected device or emulator.
Usage
Make sure you have an Android emulator running or a device connected via USB with USB debugging enabled.
Options
| Option | Description | Default |
|---|---|---|
--simulator <string> | Device name to launch (simulator or device) | First available |
--device <string> | Run on a specific device by name | Auto-detect |
--deviceId <string> | Run on a specific device by ID | Auto-detect |
--variant <string> | Build variant to run | debug |
--appId <string> | App ID to launch | From app.json |
--appIdSuffix <string> | Custom suffix for app ID | None |
--main-activity <string> | Main activity name | MainActivity |
--port <number> | Metro bundler port | 8081 |
--tasks <string> | Gradle tasks to run | installDebug |
--no-packager | Don’t start Metro bundler | false |
--verbose | Show verbose output | false |
--mode <string> | Build mode (debug/release) | debug |
--active-arch-only | Build only for device architecture | false |
Examples
Basic Usage
Specific Device
List Devices
Run on Specific Device ID
Release Build
Custom Variant
build.gradle.
Custom Metro Port
Without Packager
Verbose Output
Fast Build for Device
Build Variants
By default, React Native creates these variants:Debug
- Developer menu enabled
- Remote debugging enabled
- Not optimized or minified
- Connects to Metro bundler
Release
- Optimized and minified
- No developer tools
- Requires signing configuration
- Uses bundled JavaScript
Custom Variants
Define custom variants inandroid/app/build.gradle:
android/app/build.gradle
Common Workflows
First Time Setup
Development with Physical Device
Enable USB Debugging
On your Android device:
- Go to Settings > About phone
- Tap Build number 7 times
- Go to Settings > Developer options
- Enable USB debugging
Testing Release Build
Environment Variables
Android SDK Location
Gradle Options
Troubleshooting
SDK Not Found
Error:SDK location not found
Solution:
Create android/local.properties:
Device Not Detected
Error:No connected devices
Solution:
Build Failed
Error:Execution failed for task ':app:installDebug'
Solution:
Metro Connection Failed
Error: Red screen “Unable to load script” Solution:Build Too Slow
Solution: Add toandroid/gradle.properties:
Installed Build is Old
Solution:Build Configuration
Signing Release Build
Editandroid/app/build.gradle:
android/app/build.gradle
Performance Tips
- Fast Builds
- Smaller APK
Use architecture-specific builds:Enable Gradle daemon in
android/gradle.properties:Next Steps
Build Android
Build APK/AAB for distribution
Android Logs
View device logs for debugging
Running on Device
Complete guide for physical devices
Android Setup
Configure Android development environment