cordova platform command
Synopsis
Manage cordova platforms - allowing you to add, remove, update, list and check for updates. Running commands to add or remove platforms affects the contents of the project's platforms directory.
Syntax
cordova {platform | platforms} [ add <platform-spec> [...] {--save | link=<path> | --fetch } | {remove | rm} platform [...] {--save | --fetch}| {list | ls} | check | save | update ]
Sub-command | Option | Description |
---|---|---|
add <platform-spec> [...] | Add specified platforms | |
--save | Save <platform-spec> into config.xml after installing them using <engine> tag | |
--link=<path>
| When <platform-spec> is a local path, links the platform library directly instead of making a copy of it (support varies by platform; useful for platform development) | |
--fetch | Fetches the platform using npm install and stores it into the apps node_modules directory | |
remove <platform> [...] | Remove specified platforms | |
--save | Delete specified platforms from config.xml after removing them | |
--fetch | Removes the platform using npm uninstall and removes it from the apps node_modules directory | |
update platform [...] | Update specified platforms | |
--save | Updates the version specified in config.xml
| |
--fetch | Fetches the platform using npm install and stores it into the apps node_modules directory | |
list | List all installed and available platforms | |
check | List platforms which can be updated by cordova-cli platform update
| |
save | Save <platform-spec> of all platforms added to config.xml |
Platform-spec
There are a number of ways to specify a platform:
<platform-spec> : platform[@version] | path | url[#commit-ish]
Value | Description |
---|---|
platform | Platform name e.g. android, ios, windows etc. to be added to the project. Every release of cordova CLI pins a version for each platform. When no version is specified this version is used to add the platform. |
version | Major.minor.patch version specifier using semver |
path | Path to a directory or tarball containing a platform |
url | URL to a git repository or tarball containing a platform |
commit-ish | Commit/tag/branch reference. If none is specified, 'master' is used |
Supported Platforms
- Android
- iOS
- Windows (8.1, Phone 8.1, UWP - Windows 10)
- Blackberry10
- Ubuntu
- Browser
Deprecated Platforms
- Amazon-fireos (use Android platform instead)
- WP8 (use Windows platform instead)
- Windows 8.0 (use older versions of cordova)
- Firefox OS (use older versions of cordova)
Examples
-
Add pinned version of the
android
andios
platform and save the downloaded version toconfig.xml
:cordova platform add android ios --save
-
Add pinned version of the
android
andios
platform and save the downloaded version toconfig.xml
. Install to the project usingnpm install
and store it in the appsnode_modules
directory:cordova platform add android ios --save --fetch
-
Add
android
platform with semver version ^5.0.0 and save it toconfig.xml
:cordova platform add android@^5.0.0 --save
-
Add platform by cloning the specified git repo and checkout to the
4.0.0
tag:cordova platform add https://github.com/myfork/cordova-android.git#4.0.0
-
Add platform using a local directory named
android
:cordova platform add ../android
-
Add platform using the specified tarball:
cordova platform add ../cordova-android.tgz
-
Remove
android
platform from the project and fromconfig.xml
:cordova platform rm android --save
-
Remove
android
platform from the project and fromconfig.xml
. Runnpm uninstall
to remove it from thenode_modules
directory.cordova platform rm android --save --fetch
-
List available and installed platforms with version numbers. This is useful to find version numbers when reporting issues:
cordova platform ls
-
Save versions of all platforms currently added to the project to
config.xml
.cordova platform save
Please login to continue.