text
stringlengths
1
372
android
follow the google play console’s instructions for checking app download and
install sizes.
produce an upload package for your application:
log into your google play console. upload your application binary by drag
dropping the .aab file.
view the application’s download and install size in the android vitals ->
app size tab.
the download size is calculated based on an XXXHDPI (~640dpi) device on an
arm64-v8a architecture. your end users’ download sizes might vary depending on
their hardware.
the top tab has a toggle for download size and install size. the page also
contains optimization tips further below.
<topic_end>
<topic_start>
iOS
create an xcode app size report.
first, by configuring the app version and build as described in the
iOS create build archive instructions.
then:
sign and export the IPA. the exported directory contains
app thinning size report.txt with details about your projected
application size on different devices and versions of iOS.
the app size report for the default demo app in flutter 1.17 shows:
in this example, the app has an approximate
download size of 5.4 MB and an approximate
installation size of 13.7 MB on an iPhone12,1 (model ID / hardware
number for iPhone 11)
and iPhone11,8 (iphone XR) running iOS 13.0.
to measure an iOS app exactly,
you have to upload a release IPA to apple’s
app store connect (instructions)
and obtain the size report from there.
IPAs are commonly larger than APKs as explained
in how big is the flutter engine?, a
section in the flutter FAQ.
<topic_end>
<topic_start>
breaking down the size
starting in flutter version 1.22 and DevTools version 0.9.1,
a size analysis tool is included to help developers understand the breakdown
of the release build of their application.
warning warning
as stated in the checking total size section
above, an upload package is not representative of your end users’ download
size. be aware that redundant native library architectures and asset densities
seen in the breakdown tool can be filtered by the play store and app store.
the size analysis tool is invoked by passing the --analyze-size flag when
building:
this build is different from a standard release build in two ways.
in addition to analyzing a single build, two builds can also be diffed by
loading two *-code-size-analysis_*.json files into DevTools. see
DevTools documentation for details.
through the summary, you can get a quick idea of the size usage per category
(such as asset, native code, flutter libraries, etc). the compiled dart
native library is further broken down by package for quick analysis.
warning warning
this tool on iOS creates a .app rather than an IPA. use this tool to
evaluate the relative size of the .app’s content. to get
a closer estimate of the download size, reference the
estimating total size section above.
<topic_end>
<topic_start>
deeper analysis in DevTools
the *-code-size-analysis_*.json file produced above can be further
analyzed in deeper detail in DevTools where a tree or a treemap view can
break down the contents of the application into the individual file level and
up to function level for the dart AOT artifact.
this can be done by flutter pub global run devtools, selecting
open app size tool and uploading the JSON file.
for further information on using the DevTools app size tool, see
DevTools documentation.
<topic_end>
<topic_start>
reducing app size
when building a release version of your app,
consider using the --split-debug-info tag.
this tag can dramatically reduce code size.
for an example of using this tag, see
obfuscating dart code.
some other things you can do to make your app smaller are:
<topic_end>
<topic_start>
deferred components
<topic_end>
<topic_start>
introduction
flutter has the capability to build apps that can
download additional dart code and assets at runtime.
this allows apps to reduce install apk size and download
features and assets when needed by the user.
we refer to each uniquely downloadable bundle of dart
libraries and assets as a “deferred component”.
to load these components, use dart’s deferred imports.
they can be compiled into split AOT and JavaScript shared libraries.
info note
flutter supports deferred, or “lazy”, loading on android and the web.
the implementations differ.
android’s dynamic feature modules deliver the
deferred components packaged as android modules.