ahd786
ahd786

Reputation: 195

How to reduce .ipa file size of IOS build in Flutter?

I have created an IOS build for flutter for the app store and generated its archive which resulted in a huge 90 MB .ipa file. I searched a lot on the net that how can I reduce IPA file size but didn't got any suitable answers. I tried several methods like :

  1. flutter clean command in project terminal and then used flutter build ios command but it didn't reduce the size.
  2. I checked the option for Strip Swift Symbols but it only reduced 1 or 2 MB of size.

Does switching my Xcode project from Swift to Objective-C will reduce my .ipa file size? I am using several third party libraries in my Flutter app, are they responsible for this huge size?

  cupertino_icons: ^0.1.2
  gradient_app_bar: ^0.1.3
  url_launcher: ^5.1.2
  easy_localization: ^1.3.0+1
  http: ^0.12.0+2
  connectivity: ^0.4.4
  fluttertoast: ^3.1.3
  carousel_slider: ^1.3.0
  image_picker: ^0.6.1+4
  flutter_barcode_scanner: ^0.1.5+1

Upvotes: 11

Views: 3792

Answers (4)

kannan
kannan

Reputation: 374

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:

  1. Run flutter build ipa --export-method development .
  2. Run open build/ios/archive/*.xcarchive to open the archive in Xcode.
  3. Click Distribute App.
  4. Select a method of distribution. Development is the simplest if you don't intend to distribute the application.
  5. In App Thinning, select 'all compatible device variants'.
  6. Select Strip Swift symbols.

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.

You may also try:

flutter clean

flutter pub get

Then:

For iOS:

flutter build ios --analyze-size

flutter build ipa

Using --split-debug-info flag can dramatically reduce code size. For an example of using this flag, see Obfuscating Dart code.

Upvotes: 1

Akash Bisht
Akash Bisht

Reputation: 163

Late, but still, even when i tried

flutter build ipa

command, ipa file generated is around 90mb

So i tried creating archive with xcode, select Distribution and continue, and export the file it create.. ipa file was around 14 mb.

Upvotes: 1

Ramy Aly
Ramy Aly

Reputation: 245

As of Flutter 1.17

you will find a 20% app size reduction,

Also Obfuscating you code will decrease your app size https://flutter.dev/docs/deployment/obfuscate

Tip! in flutter 1.17 they improves app performance by 50% on iOS

Upvotes: 2

Sean
Sean

Reputation: 131

Did you try using --split-debug-info= at the end of your build command?

Upvotes: 3

Related Questions