flutter 中的 flutter build bundle 和 appbundle 有什么区别?

问题描述

我几乎没有发现关于这两者之间有什么区别的信息

Flutter build bundle
Flutter build appbundle

我什么时候应该使用一个

解决方法

flutter build appbundle

构建上传到 Google Play 商店的“应用程序包”。应用程序包基本上是一组 apk 文件。当用户安装您的应用时,Google Play 会为设备提供最佳的 apk。应用程序包被压缩成一个 aab 文件(Android 应用程序包)。

flutter build bundle 

从您的应用可以在运行时读取的 pubspec.yaml 中的资产列表构建一个特殊的“应用程序包”存档。构建器将其放置在 flutter_assets 目录中的 build 文件夹中。

所以基本上他们构建不同的东西。如果您正在构建要在 Play 商店上发布的应用,flutter build appbundle 几乎是不可避免的。

但是,我从来不需要使用 flutter build bundle。我从来不需要构建单独的资产文件夹,因为它包含在 appbundle 构建中。