Linux command
cordova 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create a new Cordova project
cordova create [myapp] [com.example.myapp] "[MyApp]"
Add a platform
cordova platform add [android]
Build the app
cordova build
Build for a specific platform
cordova build [android]
Run the app
cordova run [android]
Add a plugin
cordova plugin add [cordova-plugin-camera]
List installed plugins
cordova plugin list
Remove a platform
cordova platform remove [ios]
说明
Apache Cordova is a mobile application development framework that allows building apps for multiple platforms using HTML, CSS, and JavaScript. The CLI manages project creation, platform configuration, plugin installation, and app building. Cordova wraps web applications in a native container, providing access to device features through JavaScript APIs. Plugins bridge the gap between web code and native functionality like camera, GPS, contacts, and file system access. The workflow typically involves creating a project, adding target platforms, installing necessary plugins, developing the web app in the www directory, and using build/run commands to test on devices or emulators.
参数
- create _DIR_ _ID_ _NAME_
- Create a new Cordova project in the specified directory.
- platform add _PLATFORM_
- Add a platform (android, ios, browser, electron).
- platform remove _PLATFORM_
- Remove a platform from the project.
- build _PLATFORM_
- Build the app for specified or all platforms.
- run _PLATFORM_
- Run the app on device or emulator.
- emulate _PLATFORM_
- Run the app in a platform emulator.
- plugin add _PLUGIN_
- Add a plugin to the project.
- plugin remove _PLUGIN_
- Remove a plugin from the project.
- plugin list
- List installed plugins.
- prepare
- Copy files into platform directories for building.
- --release
- Build in release mode.
- --device
- Deploy to connected device instead of emulator.
FAQ
What is the cordova command used for?
Apache Cordova is a mobile application development framework that allows building apps for multiple platforms using HTML, CSS, and JavaScript. The CLI manages project creation, platform configuration, plugin installation, and app building. Cordova wraps web applications in a native container, providing access to device features through JavaScript APIs. Plugins bridge the gap between web code and native functionality like camera, GPS, contacts, and file system access. The workflow typically involves creating a project, adding target platforms, installing necessary plugins, developing the web app in the www directory, and using build/run commands to test on devices or emulators.
How do I run a basic cordova example?
Run `cordova create [myapp] [com.example.myapp] "[MyApp]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does create _DIR_ _ID_ _NAME_ do in cordova?
Create a new Cordova project in the specified directory.