If you spend more time typing cordova --help than actually building features, it’s time to change that. The Cordova command line interface is your most powerful tool, but only if you know the right commands. Most developers know the basics: create, platform add, build. But there’s a whole set of underused commands that can turn hours of manual work into seconds of automation. This guide walks through the commands that matter for real world development, with examples you can copy and paste today.
Mastering Cordova CLI commands means building, debugging, and deploying your app faster. Use `cordova run –device` for instant testing, `cordova requirements` to catch missing dependencies early, and `cordova plugin list` to audit your project. Combine these with shell scripts and hooks to automate repetitive tasks like version bumping or copying assets. The time you invest in learning these commands pays back tenfold on every project.
Why CLI Fluency Saves You Hours Each Week
The Cordova CLI isn’t just a launcher. It’s the bridge between your code and the native platforms. Every command you type gets you closer to a working app, but many developers only scratch the surface. The difference between a beginner and an expert is knowing which commands to use and when. For example, instead of running cordova build android every time, you can use cordova run android --device to skip the manual installation step. That one change can save 15 seconds per test cycle. Over a week with 50 test cycles, that’s over 12 minutes saved. Not huge by itself, but combine it with other time savers and you’ll gain back hours.
The Commands You Should Use Every Day
Here are the Cordova CLI commands that belong in every developer’s daily workflow. I’ve grouped them by purpose, with the most important ones first.
Project Scaffolding and Management
cordova create [path] [id] [name]– still the starting point. Use the--templateflag to clone a starter project.cordova platform add [platform]– adds Android, iOS, or browser support. Use--saveto lock the version inconfig.xml.cordova platform ls– shows which platforms are installed and their versions. Handy when you switch between machines.
Building and Running
cordova build [platform]– compiles your app. Add--releasefor production builds.cordova run [platform] --device– builds and installs directly to a connected device. On iOS, this requires a provisioning profile.cordova run [platform] --emulator– launches an emulator instance if available. Use--targetto specify a particular emulator name.cordova prepare– copieswww/files into each platform folder without rebuilding everything. Use this when you only changed HTML/CSS/JS.
Plugin Management
cordova plugin add [plugin-id] --save– installs a plugin and adds it toconfig.xml. Use--fetchwith npm or a git URL.cordova plugin ls– lists all installed plugins. Great for audits.cordova plugin remove [plugin-id]– uninstalls. Always runcordova prepareafterward.
Diagnostic and Helpful Utilities
cordova requirements– checks if all platform dependencies are installed (e.g., Java, Android SDK, Xcode). Run this when you get cryptic build errors.cordova info– prints environment info, Node version, installed platforms, and plugins. Perfect for bug reports.cordova compile– builds without the copy step. Faster thanbuildwhen you only changed native code.
A Typical Workflow in 5 Steps
Here’s a numbered list showing a real daily workflow using these commands:
- Check your setup. Run
cordova requirementsto confirm everything is installed. If it fails, fix missing SDKs before proceeding. - Pull the latest code and run
cordova prepareto sync platform files. - Add a new plugin with
cordova plugin add cordova-plugin-camera --save. Then test it by runningcordova run android --device. - Iterate on UI changes using
cordova run android --device --live-reload(requires thecordova-plugin-livereloadplugin). This updates the app on the device without a full rebuild. - Before commit, run
cordova build --releasefor your target platform to catch any late stage errors.
Table of Common Mistakes and Improvements
This table highlights typical CLI mistakes and how to fix them:
| Mistake | What Happens | Better Approach |
|---|---|---|
Running cordova build without requirements first |
Build fails with obscure errors about missing SDK | Run cordova requirements before every new project or after switching branches |
Using platform rm then platform add to update a platform |
Wastes time and can remove custom native files | Use cordova platform update [platform]@[version] instead |
Forgetting --save when adding plugins |
Plugin list becomes inconsistent between machines | Always use cordova plugin add ... --save |
Manually editing platforms/ files |
Changes get overwritten on next prepare |
Edit plugin source or use after_prepare hooks |
Not using --device flag with run |
App installs to emulator by default, wasting time | Use cordova run android --device to push to physical device |
Expert Advice: Automate the Repetitive Stuff
“The best CLI command is the one you never have to type. Use Cordova hooks and shell scripts to handle versioning, asset copying, and environment switching. A single
npm run deploycan replace five manual commands.” – Senior Mobile Developer, 2026
Hooks are scripts that run at specific points in the Cordova lifecycle. You can place them in hooks/ folder or use the --hook option. Common uses: bumping version numbers before build, copying secrets from a .env file, or running tests after prepare. If you’re not using hooks yet, start with a simple after_prepare hook that copies a custom google-services.json for Android.
Advanced CLI Techniques for 2026
Using cordova run with a Custom Debug Server
When you need to debug network requests, start a local proxy server and run cordova run android --debug -- --args="-proxy localhost:8888". The double dash passes arguments directly to the platform build tool.
Parallel Builds for Multiple Platforms
If you target both Android and iOS, you can run cordova build android & cordova build ios in the same terminal window. Each build runs in its own process. Just watch for output overlap.
Cleaning Cached Data
Sometimes cordova build fails because of stale cache. Use cordova clean [platform] to remove intermediate files. Then run cordova build again. This is faster than deleting platforms/ and re-adding.
Connecting CLI Mastery to the Bigger Picture
Knowing commands is the first step. The real power comes when you combine them with a solid development environment. For instance, if you add a plugin through the CLI, make sure to test it across platforms. A plugin that works on Android might crash on iOS because of permission differences. That’s where learning plugin internals pays off. You can read more about Mastering Cordova Plugin Development for Cross-Platform Compatibility to avoid common pitfalls.
Similarly, once your app is stable, you’ll want to optimize its performance. The CLI can help you automate performance checks. Check out Boost Your Cordova App Performance with Effective Optimization Techniques for a deeper look.
From Commands to Confidence
You don’t need to memorize every flag. Focus on the handful of commands that shave time off your loop. Start by adding cordova requirements to your startup checklist. Then use cordova run --device for every test. Once those are habits, explore hooks and automation. Each improvement compounds. The result is a development cycle that feels less like waiting and more like building. Open your terminal, run the commands from this guide, and watch your workflow get leaner. Your future self will thank you.