project.json:

{ "name": "mobile", //... "targets": { //... "run-android": { "executor": "@nrwl/react-native:run-android", "options": {} } } }
nx run mobile:run-android

Examples

To see all the avaiable emulators, run command:

emulator -list-avds

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

"run-android": { "executor": "@nrwl/react-native:run-android", "options": { "deviceId": "Pixel_5_API_30" } }

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

string

Custom params passed to gradle build command

interactive

boolean

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

listDevices

boolean
Default: false

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.

packager

boolean
Default: true

Launch packager while building

port

number
Default: 8081

The port where the packager server is listening on.

resetCache

boolean
Default: false

Resets metro cache.

sync

boolean
Default: true

Syncs npm dependencies to package.json (for React Native autolink).

tasks

Array<string>

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

jetifier

Deprecated
boolean

Run Jetifier – the AndroidX transition tool. By default it runs before Gradle to ease working with libraries that don't support AndroidX yet.

Deprecated from @react-native-community/cli. Will be remove in Nx 17.

variant

Deprecated
string
Default: debug

Specify your app's build variant (e.g. debug, release).

Deprecated from @react-native-community/cli, use mode instead, e.g. mode=debug. Will be remove in Nx 17.