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

variant

string
Default: debug

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

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

Builds only for the active architecture (e.g. x86_64, arm64-v8a).

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).

interactive

boolean
Default: true

Run packager server in interactive mode.

jetifier

boolean
Default: true

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

mainActivity

string
Default: MainActivity

Name of the activity to start.

port

number
Default: 8081

The port where the packager server is listening on.

packager

boolean
Default: true

Starts the packager server.

resetCache

boolean
Default: false

Resets metro cache.

sync

boolean
Default: true

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

tasks

string

Run custom Gradle tasks. If this argument is provided, then --variant option is ignored. Example: yarn react-native run-android --tasks clean,installDebug.

terminal

string

Launches the Metro Bundler in a new window using the specified terminal path.