🎟️ Grab your ticket for NativeScript Developer Day! Coming in April to Amsterdam. Learn more here.

NativeScript Core

tns run

Description

Runs your project on all connected devices or in native emulators for the selected platform.The command will work with all currently running Android devices and emulators. The command will prepare, build and deploy the app when necessary. By default listens for changes in your code, synchronizes those changes and refreshes all selected devices.

Commands

Usage Synopsis
Run on all connected devices $ tns run [--release] [--justlaunch]
Run on a selected connected device or running emulator. Will start emulator with specified Device Identifier, if not already running. $ tns run --device <Device ID> [--release] [--justlaunch]
Run on all connected devices of the speficied Platform $ tns run <Platform> [--release] [--justlaunch]

Options

  • --justlaunch - If set, does not print the application output in the console.
  • --release - If set, produces a release build. Otherwise, produces a debug build.
  • --device - Specifies a connected device/emulator to start and run the app. <Device ID> is the index or Device Identifier of the target device as listed by the $ tns device <Platform> --available-devices command.
  • --bundle - Specifies that the webpack bundler will be used to bundle the application.
  • --hmr - (Beta) Enables the hot module replacement (HMR) feature. HMR depends on webpack and adding the --hmr flag to the command will automatically enable the --bundle option as well. The HMR feature is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.
  • --env.* - Specifies additional flags that the bundler may process. May be passed multiple times. For example: --env.uglify --env.snapshot.
  • --syncAllFiles - Watches all production dependencies inside node_modules for changes. Triggers project rebuild if necessary!

Arguments

<Platform> is the target mobile platform for which you want to run your project. You can set the following target platforms:

  • android - Run your project on all Android devices and emulators.
  • ios - Run your project on all iOS devices and simulators.

Note: Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.

Command Limitations

  • The command will work with all connected devices and running emulators on macOS. On Windows and Linux the command will work with Android devices only.
  • In case a platform is not specified and there's no running devices and emulators, the command will fail.
Command Description
appstore Lists applications registered in iTunes Connect.
appstore upload Uploads project to iTunes Connect.
build android Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.
build ios Builds the project for iOS and produces an APP or IPA that you can manually deploy in the iOS Simulator or on device, respectively.
build Builds the project for the selected target platform and produces an application package that you can manually deploy on device or in the native emulator.
debug android Debugs your project on a connected Android device or in a native emulator.
debug ios Debugs your project on a connected iOS device or in a native emulator.
debug Debugs your project on a connected device or in a native emulator.
deploy Builds and deploys the project to a connected physical or virtual device.
run android Runs your project on a connected Android device or in a native Android emulator, if configured.
run ios Runs your project on a connected iOS device or in the iOS Simulator, if configured.
test init Configures your project for unit testing with a selected framework.
test android Runs the tests in your project on Android devices or native emulators.
test ios Runs the tests in your project on iOS devices or the iOS Simulator.