Flutter Apps are Too Big in Size

In recent times, there has been a growing concern among developers regarding the size of Flutter apps. The issue is not just limited to Android devices; even iOS users are experiencing larger app sizes with the use of Flutter.

The Problem – Minimum App Size Limit for Android and iOS

It appears that there is a minimum-limit for app size, which is around 4 MiB for Android. This limit is mentioned in another answer, but I’ll provide more details below. For iOS devices, the situation might be similar, although the exact limits are not explicitly stated.

Optimization Techniques – Running ‘flutter clean’ Before Building

To reduce the size of your Flutter app, one effective technique is to run flutter clean before building. This command cleans up temporary files and resources that can contribute to a larger app size.

flutter clean

After running this command, you can proceed with building your app using the following commands:

flutter build appbundle --target-platform android-arm,android-arm64,android-x64
flutter build apk --target-platform android-arm,android-arm64,android-x64

Comparison – Build Commands With and Without ‘flutter clean’

When I ran the build command without running flutter clean first, my app size was around 32 MiB. However, after cleaning up resources with flutter clean, the download size of my app reduced to approximately 18 MiB.

Lack of Support for x86 Architecture in Flutter

Another factor contributing to larger app sizes is the lack of support for x86 architecture in Flutter. As mentioned on the deployment page for Android, Flutter does not currently support this architecture. The Flutter team has acknowledged this limitation and provided an explanation.

Understanding App Size – A Minimal Flutter App Example

In August 2018, the Flutter team conducted an experiment to measure the size of a minimal Flutter app. This app consisted of just a single Center widget and was built using flutter build apk. The results showed that the core engine was approximately 3.2MB (compressed), while the framework + app code was around 840KB (compressed). The LICENSE file added another 55KB, and necessary Java code contributed 57KB to the total size.

core engine: ~3.2MB (compressed)
framework + app code: ~840KB (compressed)
LICENSE file: ~55KB (compressed)
necessary Java code: ~57KB (compressed)
ICU data: ~533KB (compressed)

Measuring Your Own App Size – A Suggested Approach

The Flutter team recommends measuring your own app size by running flutter build apk and examining the output. You can find the APK file in the build/app/outputs/apk/release/ directory.

Relative Differences in APK Size – Smaller With Larger Apps

The relative differences in APK size might be smaller with larger apps, as mentioned by the Flutter team. Additionally, Flutter’s overhead size is fixed, which means that app developers can expect consistent performance and optimization benefits regardless of their app’s complexity.