Cordova common commands

To install cordova:

npm install -g cordova

create app
cordova create hello com.example.hello HelloWorld

add platform
cordova platform add android

cordova platform add ios

run the following command to view:

cordova platfrom list

remove android platform support

cordova platform rm android

run The following command compiles the application:

cordova build

or

cordova build android //compile only for the Andorid platform

In fact, the build command is equivalent to the following two commands:

cordova prepare android

cordova compile android

Start the emulator:

cordova emulate android

Add plugin:
You can search with the CLI Available plugins:

cordova plugin search bar code


Install plugins like:

cordova plugin add org.apache.cordova.device //device API

cordova plugin add org.apache.cordova.network-information //network(event)

cordova plugin add org.apache.cordova.battery-status //battery(event)

cordova plugin add org.apache.cordova.device-motion //accelerator

cordova plugin add org.apache.cordova.device-orientation //compass

cordova plugin add org.apache.cordova.geolocation //orientation

cordova plugin add org.apache. cordova.camera // camera

cordova plugin add org.apache.cordova.media-capture // media file processing

cordova plugin add org.apache.cordova.media // media file processing

cordova plugin add org.apache.cordova.file // file access

cordova plugin add org.apache.cordova.file-transfer //file transfer

cordova plugin add org.apache.cordova.dialogs //dialog

cordova plugin add org.apache.cordova.vibration //vibration

cordova plugin add org.apache. cordova.contacts //contacts

cordova plugin add org.apache.cordova.globalization //globalization

cordova plugin add org.apache.cordova.splashscreen //splashscreen

cordova plugin add org.apache.cordova.inappbrowser //open new Browser window

cordova plugin add org.apache.cordova.console //Debug console

You can view all installed plugins with the following command

cordova plugin ls

Use the following command to remove the plugin:

cordova plugin rm org.apache.cordova.console   

or by Address to add plugins:

cordova plugin add https://github.com/apache/cordova-plugin-console.git

Help:

cordova help


Update cordova:

npm update -g cordova

After the cordova update is complete, you also need to update the project:

cordova platform update android

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326455483&siteId=291194637