skip to Main Content

Want to know how to reduce you flutter apk files? Currently the files produced are quite large, usually around 80 mb. This is simply too large for many purposes and it may help you to reduce the file size.

4

Answers


  1. Chosen as BEST ANSWER

    I am just sharing a small tip on how to reduce your apk file size.

    Go to: android/app/build.gradle

    and then under build types add these lines

    buildTypes {
           release {
               minifyEnabled true
               shrinkResources true
               signingConfig signingConfigs.release
           }
       }
    

  2. Run flutter build apk --split-per-abi

    This will build specific apk files for separate cpu architectures for mobile.

    By default the apk that runs in emulator has a lot of debug libraries in it which increases the apk size by a huge factor.

    Login or Signup to reply.
  3. According to flutter document, There is a option available for all platforms but not available for web so far.

    This command will help you to get a minimized size of build except web

    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
    
    Login or Signup to reply.
  4. All the answers are valid
    It seems not an instant solution, but the best approach is to follow the official flutter document for reducing the APK size, LIKE:

    1. remove the unused dart packages from pubspec.yaml
    2. Remove the unused assets like, images, gifs, sounds etc, or Atleast compress them
    3. try to avoid boilerplate code as much as you can
    4. use the central classes for constants instead writing the same code again and again.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search