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]

PARAMETERS

create path [package_name] [app_name]
    Creates a new Cordova project at the specified path.

platform add platform
    Adds a platform (e.g., android, ios, browser) to the project.

platform rm platform
    Removes a platform from the project.

platform ls
    Lists the platforms that are currently added to the project.

plugin add plugin_name
    Adds a plugin to the project.

plugin rm plugin_name
    Removes a plugin to the project.

plugin ls
    Lists the plugins that are currently added to the project.

build [platform]
    Builds the application for the specified platform (or all platforms if none specified).

emulate [platform]
    Emulates the application on a platform-specific emulator or simulator.

run [platform]
    Runs the application on a connected device or emulator/simulator.

prepare [platform]
    Copies www files into platform specific folder.

serve [platform]
    Runs a local web server to serve the application's files.

--version
    Displays the version of the Cordova CLI.

--help
    Displays help information about the Cordova CLI.

DESCRIPTION

The cordova command is a command-line interface (CLI) tool that allows you to create, build, and deploy hybrid mobile applications using web technologies such as HTML, CSS, and JavaScript.

Cordova wraps your web application within a native container, allowing it to access device features like the camera, accelerometer, and contacts through plugins. This enables you to build cross-platform apps that run on various mobile operating systems (iOS, Android, Windows Phone, etc.) from a single codebase.

The Cordova CLI simplifies the development workflow by providing a consistent interface for managing projects, installing plugins, and building app packages for different platforms. It abstracts away much of the platform-specific complexity, allowing developers to focus on writing web-based code. The resulting applications can be deployed to app stores or used as enterprise applications.

CAVEATS

Cordova relies on platform-specific SDKs (e.g., Android SDK, Xcode for iOS). Make sure these are correctly installed and configured before using Cordova. Build failures can often be attributed to issues with these SDKs.

CONFIGURATION

Cordova projects use a config.xml file to define app metadata, preferences, and plugin dependencies. This file is crucial for customizing the application's behavior and appearance on different platforms.

PLUGINS

Cordova plugins provide access to native device capabilities. There's a rich ecosystem of both official and community-developed plugins that can be easily integrated into your Cordova project.

HISTORY

Cordova evolved from the PhoneGap project, initially developed by Nitobi Software. Adobe acquired Nitobi in 2011 and open-sourced PhoneGap as Apache Cordova. It has become a widely used framework for building cross-platform mobile applications.

SEE ALSO

adb(1), xcodebuild(1)

Copied to clipboard