In-app development, it is important to manage its performance. Performance covers different aspects like speed and responsiveness and it depends on things like app size and rendering performance.
if we talk about issues related to performance there are two types of issues some are space-related issues and some are time-related issues.
Time-related issues occur when the app starts consuming too much time on any tasks or when it forces the device to run at a faster pace.
Here we are going to address the problem of app size, as you well know when we build our app it consists of too many things and in the end, we get an app bigger in size so here we are going to learn how do we get rid of this issue.
App size is an issue that can bother anyone whether they are developers or users. as you know that the APK, app bundle, or IPA all of them contain everything like code and assets and run itself with them and if it’s size is heavy then it may create trouble because if it is large in size it will take more space and it may break the limit of useful features like Android instant apps.
when you launch your app using the IDE button or by running
_flutter run_
the command, it generates a debug build and large in size but it allows to hot reload and source-level debugging.
Now we would see how we check and estimate the size of a flutter app…
The release APK generally we create usingflutter build apk
or flutter build ios
provide the uploaded package to the play store or app store but they do not represent the end user’s download size, the app store generally reprocesses and split the uploaded package to in order to make suitable for the downloader’s device by filtering the things like native’s library, phone’s DPI.
Size reduction becomes one of the vital processes when it comes to making your app available for users.
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.
The size analysis tool is invoked by passing the --analyze-size
flag when building:
flutter build apk --analyze-size
flutter build appbundle --analyze-size
flutter build ios --analyze-size
flutter build linux --analyze-size
flutter build macos --analyze-size
flutter build windows --analyze-size
In the case of android APK or bundle, you also need to mention the target platform and one of the android arm so the commands will be like
flutter build apk --target-platform android-arm --analyze-size
flutter build apk --target-platform android-arm64 --analyze-size
flutter build apk --target-platform android-x64 --analyze-size
flutter build appbundle --target-platform android-arm --analyze-size
flutter build appbundle --target-platform android-arm64 --analyze-size
flutter build appbundle --target-platform android-x64 --analyze-size
and the result will be like
#app-size #app-optimization #flutter #obfuscation #app-performance