Reduce flutter app size

Reduce flutter app size

Introduction

Flutter is a new mobile app development framework from Google. It’s intended to make it easier for developers to build beautiful, high-performance apps for Android and iOS. In this tutorial we’ll learn how to reduce our flutter app size by removing debug code from APK and obfuscating dart code

Instruments

Instruments is a macOS and iOS tool for profiling your app. It provides a window into your app’s performance, letting you see what is happening as it runs. Instruments can help you find and fix performance issues, including:

  • What parts of the code are taking longest to run?

  • Which functions call other functions often (and thus should be optimized)?

Obfuscate Dart Code

Obfuscation is a security measure to make it harder for malicious hackers to reverse engineer your app. It’s a good idea to obfuscate your code before publishing it on the play store.

Remove debug code from Release APK

  • Remove debug code from release apk

  • Remove unused resources and images from your project.

Assemble and upload release APK to Play Store

To upload your app to the Play Store, you’ll need to use the flutter build command. This will create a release APK that you can then upload using the flutter upload command. You should check that your build type and version number are correct before uploading.

In order for users to install your app from Google Play, they must have installed it from within their device’s system settings (if not already done so).

We can reduce our flutter app size significantly!

  • Reducing flutter app size

You can reduce your flutter app size significantly by obfuscating dart code and removing debug code from release apk.

  • Obfuscating dart code: We can do this by adding a custom option to our build tool. This will add an APK property called “obfuscation” that you must set to true before uploading your app to Play Store. It’s worth noting here that this step is not required for iOS applications, but it does help with Android device compatibility issues when using Google Play Services SDKs (e.g., Google Maps). For example: if you have used the Flutter SDK for iOS development previously, then it may be necessary for you to manually remove debug symbols from some of these libraries so they aren’t included in future builds during deployment; otherwise they would cause errors during runtime execution due to lack thereof being present within them at launch time.* Removing debug symbols from production apps via command line tools such as “devenv” or “adb shell”; see below for instruction on how

Conclusion

If you’re interested in getting a glimpse of how we reduced our app size by 60%, then please check out the section on the tools that were used to do so. This blog post has been a long one, and I think it’s time to wrap things up here!

Did you find this article valuable?

Support Harvinder Singh by becoming a sponsor. Any amount is appreciated!