Flutter从1.5升级到1.7.4后,APK大小增加了一倍? [英] APK size doubled after Flutter upgrade from 1.5 to 1.7.4?

查看:117
本文介绍了Flutter从1.5升级到1.7.4后,APK大小增加了一倍?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么将Flutter从1.5升级到1.7.4后我的应用程序大小几乎翻倍?

Why is the size of my app nearly doubled after upgrading Flutter from 1.5 to 1.7.4?

代码相同,但是APK大小从 7.6 MB 14.2 MB

我正在使用 flutter build apk

The code is same, however, the APK size increased from 7.6 MB to 14.2 MB.
I am using flutter build apk.

推荐答案

此行为是对此Play商店警告

Flutter现在包括默认情况下,使用 flutter build apk 构建的APK中的32位 64位二进制

This behavior is in response to this Play Store warning.
Flutter now includes 32-bit and 64-bit binaries in APKs built using flutter build apk by default which effectively doubles the APK size as it is a fat APK which contains binaries for both ABIs.

有两种方法可以再次减小APK大小:

There are two ways you can go about reducing your APK size again:


  • flutter build appbundle

此选项是首选可以上传单个文件(> 14 MB ),然后Play商店会从App Bundle中为每台设备构建不同的APK,这意味着下载大小 APK大约为 7 MB

了解更多。

This option is the preferred way for the Play Store as you are able to upload a single file (that will be >14 MB in your case) and the Play Store then builds different APKs for every device from the App Bundle, which means that the download size of the APK will be around 7 MB.
Learn more.

flutter build apk --split-per-abi

此命令将仅输出两个不同的 APK文件,一个用于32位,一个用于64位,每个文件的大小约为 7 MB 。但是,这意味着如果您要使用这些文件分发应用程序,则必须将多个文件上传到Play商店。

This command will simply output two different APK files, one for 32-bit and one for 64-bit, each being about 7 MB. However, this means that you will have to upload multiple files to the Play Store if you are using that to distribute your application.

了解详情。

这篇关于Flutter从1.5升级到1.7.4后,APK大小增加了一倍?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆