project.json:

1{ 2 "name": "mobile", 3 //... 4 "targets": { 5 //... 6 "run-android": { 7 "executor": "@nx/react-native:run-android", 8 "options": {} 9 } 10 } 11} 12
1nx run mobile:run-android 2

Examples

To see all the avaiable emulators, run command:

1emulator -list-avds 2

The deviceId option allows you to launch your android app in a specific device/simulator:

1 "run-android": { 2 "executor": "@nx/react-native:run-android", 3 "options": { 4 "deviceId": "Pixel_5_API_30" 5 } 6 } 7

Options

mode

string
Default: debug

Specify your app's build variant

appId

string

Specify an applicationId to launch after build. If not specified, package from AndroidManifest.xml will be used.

appIdSuffix

string

Specify an applicationIdSuffix to launch after build.

activeArchOnly

boolean
Default: false

Build native libraries only for the current device architecture for debug builds.

binaryPath

string

Path relative to project root where pre-built .apk binary lives.

deviceId

string

Builds your app and starts it on a specific device/simulator with the given device id (listed by running adb devices on the command line).

extraParams

oneOf [Array<string>, string]

Custom params passed to gradle build command

interactive

boolean

Explicitly select build type and flavour to use before running a build

listDevices

boolean

Lists all available Android devices and simulators and let you choose one to run the app

mainActivity

string
Default: MainActivity

Name of the activity to start.

port

number
Default: 8081

The port where the packager server is listening on.

resetCache

boolean
Default: false

Resets metro cache.

tasks

oneOf [Array<string>, string]

Run custom Gradle tasks. By default it's "assembleDebug". Will override passed mode and variant arguments.