Home > Mobile >  Flutter app size is too big, almost 150MB
Flutter app size is too big, almost 150MB

Time:10-25

I am creating Flutter paraphrasing app but my app size is too big, I don't know why?

App is used for paraphrasing, the text user can enter text, speak or extract text from file. We translate and paraphrase the text. I created this for my software house but i don't know why app size is too big. I am not even using static assets still app size is 158MB

name: paraphrase_and_translate
description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0 1

environment:
  sdk: ">=2.17.6 <3.0.0"

dependencies:
  flutter:
    sdk: flutter


  cupertino_icons: ^1.0.2
  speech_to_text: ^5.5.0
  google_ml_kit: ^0.11.0
  camera: ^0.9.7 1
  image_picker: ^0.8.5 3
  translator: ^0.1.7
  clipboard: ^0.1.2 8
  pdf_text: ^0.5.0
  file_picker: ^4.6.1
  permission_handler: ^10.0.0
  flex_color_scheme: ^5.1.0
  font_awesome_flutter: ^10.1.0
  dio: ^4.0.6
  rounded_loading_button: ^2.0.8
  language_picker: ^0.4.1
  google_fonts: ^3.0.1
  flutter_tts: ^3.5.0
  simple_speed_dial: ^0.1.7
  animated_splash_screen: ^1.3.0
  flutter_launcher_icons: ^0.10.0
  facebook_audience_network: ^1.0.1
  google_mobile_ads: ^2.0.1

dev_dependencies:
  flutter_test:
    sdk: flutter
flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/icon.png"

  flutter_lints: ^2.0.0

flutter:


  uses-material-design: true

  assets:
    - assets/images/new.png
    - assets/images/parapharse.png
    - assets/images/icon.png

This is my pubspec.yaml file. images are only 2 mbs only

Running "flutter pub get" in paraphrase_and_translate...
Launching lib\main.dart on Redmi Note 8 in release mode...
Running Gradle task 'assembleRelease'...
√  Built build\app\outputs\flutter-apk\app-release.apk (159.1MB).
Installing build\app\outputs\flutter-apk\app.apk...

CodePudding user response:

If DevTools is already connected to a running application, navigate to the “App Size” tab. Check which module is using what size and manage accordingly, also only use required packages and removed unnecessary assets or resize them if possible.

CodePudding user response:

May be the package google_ml_kit increse the build size.

Try using any specific package that useful to you, mentioned in dependencies of the Dependencies

All these packages are included in the google_ml_kit package. Avoid using unwanted packages.

For instance use google_mlkit_text_recognition if you are using text recognition alone instead of all.

CodePudding user response:

Also: don't use an APK, but an appbundle for Android. It build way smaller binaries. For this, use:

flutter build appbundle

CodePudding user response:

Go to Android > app > build.gradle and set the minSdkVersion to 22

    defaultConfig {
        applicationId "com.app.app"
        minSdkVersion 22  // set this to min 22
        targetSdkVersion 31

    }
  • Related