Search docs/

ionic cordova run

Contents

Run an Ionic project on a connected device

ionic cordova run [<platform>] [options]

Build your app and deploy it to devices and emulators using this command. Optionally specify the --livereload option to use the dev server from ionic serve for livereload functionality.

This command will first use ionic build to build web assets (or ionic serve with the --livereload option). Then, cordova build is used to compile and prepare your app. Finally, the native-run utility is used to run your app on a device. To use Cordova for this process instead, use the --no-native-run option.

If you have multiple devices and emulators, you can target a specific one with the --target option. You can list targets with --list.

For Android and iOS, you can setup Remote Debugging on your device with browser development tools using these docs.

When using --livereload with hardware devices, remember that livereload needs an active connection between device and computer. In some scenarios, you may need to host the dev server on an external address using the --external option. See these docs for more information.

Just like with ionic cordova build, you can pass additional options to the Cordova CLI using the -- separator. To pass additional options to the dev server, consider using ionic serve separately and using the --livereload-url option.

Examples

ionic cordova run androidionic cordova run android --buildConfig=build.jsonionic cordova run android --prod --release -- -- --gradleArg=-PcdvBuildMultipleApks=trueionic cordova run android --prod --release -- -- --keystore=filename.keystore --alias=myaliasionic cordova run android --prod --release -- -- --minSdkVersion=21ionic cordova run android --prod --release -- -- --versionCode=55ionic cordova run android --prod --release --buildConfig=build.jsonionic cordova run android -lionic cordova run iosionic cordova run ios --buildConfig=build.jsonionic cordova run ios --livereload --externalionic cordova run ios --livereload-url=http://localhost:8100ionic cordova run ios --prod --releaseionic cordova run ios --prod --release -- --developmentTeam="ABCD" --codeSignIdentity="iPhone Developer" --packageType="app-store"ionic cordova run ios --prod --release --buildConfig=build.json

Inputs

platform

Description

The platform to run (e.g. android, ios)

Options

--ssl

Description

Use HTTPS for the dev server

--prod

Description

Flag to use the production configuration

--list

Description

List all available targets

--no-build

Description

Do not invoke Ionic build

--external

Description

Host dev server on all network interfaces (i.e. --address=0.0.0.0)

--livereload

Description

Spin up dev server to live-reload www files

Aliases-l

--livereload-url=<url>

Description

Provide a custom URL to the dev server

--debug

Description

Mark as a debug build

--release

Description

Mark as a release build

--device

Description

Deploy build to a device

--emulator

Description

Deploy build to an emulator

--no-native-run

Description

Do not use native-run to run the app; use Cordova instead

--connect

Description

Tie the running app to the process

Advanced Options

--consolelogs

Description

Print app console logs to the terminal

--consolelogs-port=<port>

Description

Use specific port for console logs server

--address=<address>

Description

Use specific address for the dev server

Defaultlocalhost

--port=<port>

Description

Use specific port for HTTP

Aliases-p
Default8100

--devapp

Description

Publish DevApp service

--configuration=<conf>

Description

Specify the configuration to use.

Aliases-c

--source-map

Description

Output source maps

--buildConfig=<file>

Description

Use the specified build configuration

--target=<target>

Description

Deploy build to a device (use --list to see all)

--json

Description

Output targets in JSON