Cordova Basic Commands

cordova

Create a New Project

At this point, to create a new project you can choose between the cross-platform CLI tool described in The Command-Line Interface, or the set of Android-specific shell tools. From within a source-code directory, here’s the CLI approach:

$ cordova create HelloWorld
$ cd hello
$ cordova platform add android
$ cordova prepare                               # or "cordova build" "cordova build android"

Build the Project

If you are using the CLI in development, the project directory’s top-level www directory contains the source files. Run any of these within the project directory to rebuild the app:

$ cordova build                                 # build all platforms that were added
$ cordova build android                         # build debug for only Android
$ cordova build android --debug                 # build debug for only Android
$ cordova build android --release               # build release for only Android

Deploy the app

You can use the cordova CLI utility to deploy the application to the emulator or the device from the command line:

$ cordova emulate android                       #to deploy the app on a default Android emulator
$ cordova run android --device                  #to deploy the app on a connected device
$ cordova run android --list                    #see all available targets
$ cordova run android --target=target_name      #run application on a specific device or emulator

You can also use cordova run –help to see additional build and run options.

Other commands

$ cordova platform rm android                   # remove platform
$ cordova platform version                      # show platform version
$ cordova plugin add cordova-plugin-camera      # add plugins
$ cordova platform update android               # update platfrom
$ cordova plugins                               # show plugins