Need advice about which tool to choose?Ask the StackShare community!
Apache Cordova vs Electron: What are the differences?
Introduction
Apache Cordova and Electron are two popular frameworks for developing cross-platform desktop and mobile applications. While both frameworks enable developers to build applications using web technologies such as HTML, CSS, and JavaScript, there are several key differences between them. Below are six major differences between Apache Cordova and Electron.
Architecture: Apache Cordova is based on a hybrid architecture, where the UI is rendered inside a native WebView component, providing access to device features through plugins. On the other hand, Electron follows a web-based architecture, where the UI is rendered using Chromium and Node.js, allowing access to both local and web resources.
Platform Support: Apache Cordova is primarily used for developing mobile applications and supports a wide range of platforms, including iOS, Android, Windows Phone, and more. In contrast, Electron focuses on desktop application development and primarily supports Windows, macOS, and Linux operating systems.
Distribution: With Apache Cordova, applications need to be submitted to mobile app stores like the App Store or Google Play Store for distribution. On the contrary, Electron allows developers to distribute applications as standalone executables, making it easier to distribute and install desktop applications without going through an app store.
Native API Access: Apache Cordova provides a vast number of plugins that allow developers to access native device features like camera, accelerometer, and contacts. In Electron, since the application runs on the user's machine, it has direct access to the native operating system APIs without the need for plugins.
User Interface: Apache Cordova applications are built using HTML, CSS, and JavaScript and provide UI components that resemble native mobile interfaces. Electron, on the other hand, supports the use of web technologies but also allows developers to create native-like desktop interfaces with improved flexibility and control.
Performance: Due to its hybrid architecture and reliance on a WebView component, Apache Cordova applications may suffer from performance limitations, especially for complex or resource-intensive tasks. Electron, being based on Chromium, provides better performance as it leverages the capabilities of the underlying browser engine.
In Summary, Apache Cordova and Electron differ in their architecture, platform support, distribution methods, access to native APIs, user interface capabilities, and performance characteristics. These differences make each framework better suited for specific use cases, be it mobile app development with Cordova or desktop app development with Electron.
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!
As an network mesh technology, a recurring design challenge for us is to create isomorphic (same-shaped) javascript code that supports FHIR data anwyhere... server, client, database, tooling, microcontrollers, etc. That means compiling our code to both Android and iPhone; and to both Windows and Mac and Linux. Electron gets us our desktop deployment and is our gateway into the world of Windows.
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 Electron
- Easy to make rich cross platform desktop applications69
- Open source53
- Great looking apps such as Slack and Visual Studio Code14
- Because it's cross platform8
- Use Node.js in the Main Process4
Sign up to add or upvote prosMake informed product decisions
Cons of Apache Cordova
- No native performance2
- Hard to install1
- Hard to install0
Cons of Electron
- Uses a lot of memory19
- User experience never as good as a native app8
- No proper documentation4
- Does not native4
- Each app needs to install a new chromium + nodejs1
- Wrong reference for dom inspection1