LinuxCommandLibrary

cordova

Build cross-platform mobile applications

TLDR

Create a Cordova project

$ cordova create [path/to/directory] [package] [project_name]
copy

Display the current workspace status
$ cordova info
copy

Add a Cordova platform
$ cordova platform add [platform]
copy

Remove a Cordova platform
$ cordova platform remove [platform]
copy

Add a Cordova plugin
$ cordova plugin add [pluginid]
copy

Remove a Cordova plugin
$ cordova plugin remove [pluginid]
copy

SYNOPSIS

cordova <command> [options] [<path> ...]

PARAMETERS

--debug
    Build in debug mode for development

--release
    Build optimized release version

--verbose
    Enable verbose logging

--nobuild
    Skip build step, use existing build

--device
    Run on connected physical device

--emulator
    Run on emulator/simulator

--target
    Specify target device/emulator ID

--help
    Show command help

--version
    Display Cordova version

DESCRIPTION

Apache Cordova enables building cross-platform mobile apps using HTML, CSS, and JavaScript, wrapping them in native containers for access to device APIs. The cordova command-line interface (CLI) is the core tool for managing Cordova projects on Linux and other platforms.

It supports creating new projects, adding/removing platforms (e.g., Android, iOS, browser), managing plugins, building apps for release or debug, running on devices/emulators, and serving for testing. Cordova projects are web apps enhanced with plugins for features like camera, geolocation, and file system.

Installation requires Node.js and npm: npm install -g cordova. Platform-specific SDKs (e.g., Android Studio for Android) are needed for building. Ideal for developers targeting multiple OS without rewriting UI code, though performance may lag behind fully native apps. Integrates with frameworks like Ionic for richer UIs.

CAVEATS

Requires Node.js/npm and platform SDKs (e.g., Android SDK). iOS builds need macOS/Xcode. Large plugin ecosystem may introduce compatibility issues.

INSTALLATION

npm install -g cordova
Verify: cordova --version

COMMON COMMANDS

cordova create hello com.example.hello HelloWorld
cordova platform add android
cordova plugin add cordova-plugin-camera
cordova build android
cordova run android

PLATFORMS

Supported: android, browser, electron, ios, osx, windows, ubuntu. Add via cordova platform add <platform>

HISTORY

Originated as PhoneGap by Nitobi in 2009. Adobe acquired Nitobi in 2011, donated to Apache Software Foundation as Cordova (version 3.0). Evolved to version 12+ with improved CLI, npm-based plugins, and better platform support.

SEE ALSO

npm(1), node(1)

Copied to clipboard