Need advice about which tool to choose?Ask the StackShare community!
Apache Cordova vs Capacitor: What are the differences?
Apache Cordova and Capacitor are both frameworks for building cross-platform mobile applications using web technologies. Let's explore the key differences between the two.
Cross-platform support: Apache Cordova is primarily focused on providing cross-platform support by packaging web applications into native mobile apps using WebView. It allows developers to write code once and deploy it across multiple platforms like iOS, Android, and Windows Phone. Capacitor, on the other hand, is built on top of Cordova but provides additional cross-platform support for features like InAppBrowser and Camera that are not available in Cordova by default.
Plugin architecture: Cordova follows a plugin-based architecture which allows developers to extend the functionality of their applications by adding plugins. These plugins provide access to native device features that are not available through web technologies alone. Capacitor also follows a similar plugin architecture but with a different approach. Instead of relying on Cordova plugins, Capacitor uses its own set of plugins which are built specifically for Capacitor and offer better performance and reliability.
Modern development workflow: Capacitor offers a more modern development workflow compared to Cordova. It allows developers to write modern TypeScript or ECMAScript 6+ code, use modern JavaScript frameworks like React or Angular, and leverage modern tooling such as webpack or Babel. Cordova, on the other hand, has a more mature ecosystem but is based on older web technologies and may require additional setup or configuration for modern development practices.
Native API access: Capacitor provides direct access to Native APIs, allowing developers to call native functionality directly from their JavaScript code. This eliminates the need for plugins in many cases and provides a more seamless integration with native platform features. Cordova, on the other hand, relies heavily on plugins for accessing native functionality, which may introduce some overhead and dependencies on third-party plugins.
Community and ecosystem: Cordova has been around for a longer time and has a larger community and ecosystem compared to Capacitor. This means that Cordova has a vast number of plugins and resources available for developers, making it easier to find solutions and add new features to applications. Capacitor, being relatively newer, has a smaller but growing community and may have fewer resources available compared to Cordova.
Migration from Cordova to Capacitor: Capacitor provides a migration tool that allows developers to easily migrate their existing Cordova projects to Capacitor. This makes it easier for developers to switch from Cordova to Capacitor without having to rewrite their code from scratch. Cordova, on the other hand, does not provide any official migration path to Capacitor, which may require developers to manually refactor their code when transitioning.
In summary, Apache Cordova is a well-established choice for cross-platform development, while Capacitor, with its focus on native features and performance, provides a modern alternative for building mobile applications using web technologies.
I've done some Hybrid Mobile apps with both technologies Apache Cordova
and React Native
and described my experience in my blog.
In a few words, I would suggest to use each technology in accordance what what is your current code base and what do you want to achieve.
React Native is a great option if you need that extra edge in performance with multi-threading and native UI rendering. Or you already have a web app based on React which you want to port to mobile.
On the other hand, if you have an existing web application code and you want to reuse some or all, including the ability to use web third-party libraries, then Cordova is the best option.
Proguard
?
ProGuard is the most popular optimizer for Java bytecode. It makes your Java and Android applications up to 90% smaller and up to 20% faster. ProGuard also provides minimal protection against reverse engineering by obfuscating the names of classes, fields and methods.
How to use it inCordova
app?
I didn't find any plugins for it. So I've implemented it by myself and shared it on GitHub.
Feel free to use!
Pros of Apache Cordova
- Lots of plugins48
- JavaScript35
- Great community26
- Easy Development25
- Easy to learn18
- Cross platform15
- Open Source7
- Easy, fast, not buggy in my experience with my code6
- Lots of descendants; PhoneGap, Ionic, Intel XDA etc6
- Can use CSS34
- Rich HTML 54
- Easy debugging4
- HTML, CSS and JS3
- Fast and hot reload3
- Rich css ui3
- Use what you code in your browser3
- Need a light system2
- Native Web Technologies2
- Without extra tooling needed2
- One code base everywhere2
Pros of Capacitor
- Full compatible with ios1
- Modern1
Sign up to add or upvote prosMake informed product decisions
Cons of Apache Cordova
- No native performance2
- Hard to install1
- Hard to install0