Skip to content

Would like an article which explains how to reduce APK size #2183

Closed

Description

@eseidelGoogle

A frequently asked question on our mailing lists is how to understand and reduce the size of ones Flutter-built APK.

A common misconception is judging the size of Flutter APKs built in --debug mode instead of --release. --debug apks are about 3x the size of --release APKs.

Note: flutter run defaults to --debug, however flutter build apk defaults to --release.

We have an FAQ explaining the size overhead in --release APKs, which is currently still larger than we'd like:
https://flutter.io/faq/#how-big-is-the-flutter-engine
but I suspect we also need an article (on the website or otherwise) which explains the process of analyzing APK size and reducing it from a Flutter-specific perspective.

Activity

  1. eseidelGoogle commented on Apr 20, 2018

    @eseidelGoogle
    ContributorAuthor

    Another common confusion is .apk size (compressed) vs. .ipa size (uncompressed).

    This is a very common confusion and we probably need at least some FAQ entries, if not a full on article to explain sizes in better detail. FYI @mit-mit

  2. goderbauer commented on Aug 1, 2018

    @goderbauer
    Member

    /cc me

  3. Hixie commented on Jan 9, 2019

    @Hixie
    Contributor

    @eseidelGoogle Can you elaborate on what you would want such an article to say?

  4. transferred this issue fromflutter/flutteron Jan 9, 2019
  5. eseidelGoogle commented on Jan 9, 2019

    @eseidelGoogle
    ContributorAuthor

    What is the link I should point people to when they think Flutter APKs are too large? (or when they file bugs like the above linked?)

    What is the set of steps they should walk through to make sure their app is as small as possible?
    e.g. make sure they're looking at --release
    What tool should they use to understand where the space is going?
    What compression tips/techniques should they be applying to their assets? What Apple/Android resources should they be linked to?

    This is probably actually a medium article. At the time we seemed to be getting lots of these requests.

    We can close this if @mjohnsullivan, @Sfshaza etc. track such ideas in other ways.

  6. eseidelGoogle commented on Jan 11, 2019

    @eseidelGoogle
    ContributorAuthor

    I see questions about size on Twitter/Reddit frequently. Another this morning:
    https://twitter.com/android_sattout/status/1083683098682888192

  7. eseidelGoogle commented on Jan 22, 2019

    @eseidelGoogle
    ContributorAuthor

    Another user hit the --debug size gotcha: https://twitter.com/VDnewcastle/status/1087414701867167744

  8. eseidelGoogle commented on Jan 25, 2019

    @eseidelGoogle
    ContributorAuthor

    We get soooo many questions about this. We had another question from customer: amplify, who wanted to understand why Flutter was adding 20MB to their app. But there are lots of questions about that which an article could help with?

    • What does 20MB mean? Is it release? Debug? Is it compressed, uncompressed? Does that necessarily mean it's sent to users (or do the stores shard the app bundles)?
    • How do they look at the whole APK/IPA and understand what is contributing what?
    • What are reasonable expectations of how much Flutter should inflate your binary size?

    We also got more related confusion on Gitter this morning:

    "hey guys got a question, so when you compile an app with say flutter build app --release by default it produces an app that is compatible with armeabi-v7a, armeabi-v8a and others, my app goes to over 24Mb, my question is, when i upload this 24Mb app to google play, does play then decide which version goes to which specific device and reduce the download size to the usual s4-7Mb size>>??"

    This is just a very common topic where more docs could help. :)

  9. added
    p1-highMajor but not urgent concern: Resolve in months. Update each month.
    e2-daysEffort: < 5 days
    on Jan 25, 2019
  10. eseidelGoogle commented on Nov 30, 2021

    @eseidelGoogle
    ContributorAuthor

    There has been some progress on this. We now have better tooling around understanding APK size:
    https://docs.flutter.dev/development/tools/devtools/app-size

    There was also a detailed analysis of Flutter's current APK size done internally in 2019 (go/flutter-apk-size), we unfortunately don't currently have a public (or 2021 updated) version of that, but I leave that here for later Googlers looking at this bug.

  11. sfshaza2 commented on Feb 16, 2023

    @sfshaza2
    Contributor

    We now have the apk-size page. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    e2-daysEffort: < 5 daysp1-highMajor but not urgent concern: Resolve in months. Update each month.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions