Ionic Cordova 与 Cordova 命令的区别

Difference of Ionic Cordova vs Cordova commands

我一直对使用此命令构建 apk 的区别感到困惑:

ionic cordova 构建 android

cordova 构建 android.

当我查看路径

上的调试 apk 时,它似乎有不同的输出或文件大小

/platform/android/app/build/outputs/apk

ionic cordova build android 直接类似于 运行 cordova build,但也使用 ionic build 的配置构建 Web 资产并提供友好检查。

查看文档here

到目前为止,Cordova 拥有自己的库,并且稳定的 ionics 也使用它们。

https://cordova.apache.org/docs/en/latest/ Apache Cordova is an open-source mobile development framework. It allows you to use standard web technologies - HTML5, CSS3, and JavaScript for cross-platform development. Applications execute within wrappers targeted to each platform, and rely on standards-compliant API bindings to access each device's capabilities such as sensors, data, network status, etc.

ionic 也使用该库进行框架和开发,所以在那种情况下

最好的方法是为什么 ionic 使用 Cordova

Ionic, Cordova and PhoneGap are hybrid apps. ... They are written in JavaScript but are rendered using native components, which means that the user experience will generally be closer to other native apps, because they will conform to the standards imposed by the operating system

https://www.netguru.com/blog/why-you-should-migrate-your-app-from-ionic-cordova-or-phonegap-to-react-native

Ionic 附带许多内置组件,在大多数情况下 UX/UI 更接近本机组件。这是使用离子的基本优势。

The fact is, Ionic is built on top of Cordova, so you cannot argue that ionic runs better than Cordova itself. Ionic is like steroids that you can give to your Cordova apps.

CLI

在 ionic 环境中,最好始终建议在 Cordova 上使用 Ionic CLI 命令。这是为了确保 ionic 将其所有 components/files 与 Cordova 和您的应用程序逻辑一起正确打包。

输出大小

APK/IPA 大小因包含的逻辑量​​而异,更不用说来自特定框架的代码了。如果一个简单的 Cordova 应用程序是 4mb,那么 ionic 将是 4mb + ionic 组件的大小。像 Angular 这样的框架有像 Ivy 这样的复杂引擎,可以减少应用程序构建的大小,但它们不会重构任何与 Ionic 或 Cordova 相关的东西。