- Overview
- Installation
- Creating an App
- Project Structure
- CLI Commands
- Platform Support
- Platform Pinning
- Version Management
- Hooks
- Android
- iOS
- Electron
- Icons
- Splash Screen
- Security
- Privacy
- Allow List
- Data Storage
- Create a Plugin
- Android
- iOS
- Use Plugman
- Config.xml API
- Plugin.xml API
- Cordova JavaScript API
- Third-party Tools
- App Templates
- Next Steps
- Battery Status
- Camera
- Device
- Dialogs
- File
- Geolocation
- Inappbrowser
- Media
- Media Capture
- Network Information
- Screen Orientation
- Browser Splashscreen
- Statusbar
- Vibration
- Embed Cordova in native apps
Platform Pinning
Cordova CLI 12.x & Higher
Starting from Cordova CLI 12.0.0, the CLI no longer maintains a list of pinned Apache Cordova platforms.
When you run the cordova platform add <PLATFORM>
command, it will always fetch the latest available platform from the npm registry. This ensures immediate access to newly released platforms.
If you want to consistently fetch a specific version, you need to modify the command and include the version pinning. For example, use cordova platform add <PLATFORM>@<VERSION>
.
The cordova platform list
command displays the list of platforms without their versions. However, it will continue to show the versions of the installed platforms.
Example Output:
$ cordova platform list
Installed platforms:
android 12.0.0
Available platforms:
browser
electron
ios
Cordova CLI 11.x & Lower
Cordova CLI 11.x and lower versions still use platform pinning but won't receive further updates since Cordova CLI 12.0.0 has been released. Platforms are pinned with a ^
symbol, allowing the CLI to fetch new minor and patch releases for the pinned platforms.
To view the pinned platforms for your CLI version, run the command cordova platform list
in a new project directory.
Example Output:
$ cordova platform list
Installed platforms:
Available platforms:
android ^10.1.1
browser ^6.0.0
electron ^3.0.0
ios ^6.2.0
osx ^6.0.0 (deprecated)
Based on the above information, executing cordova platform add android
will fetch the latest minor/patch release version starting from 10.1.1 or higher. If you specify a version, it will fetch the specified version. For example, cordova platform add ios@5.0.1
will fetch Cordova iOS 5.0.1.
Note: After installing a platform, the "Installed platforms:" section will display the actual installed platform version. The installed platform will no longer appear in the "Available platforms:" section until it is removed from the project.