flutter ios release size is way larger than apk release - flutter

I am trying to release my flutter app and I encountered this problem where the release size of ios app is too large. The apk release size is about 21.4 MB and the ios release size is about 480 MB!! I don't know what is the problem I tried to update flutter and flutter clean but nothing has changed.
These are my dependencies in pubspec.yaml file
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
intl: ^0.16.1
provider: ^4.1.3
image_picker: ^0.6.7+4
firebase_auth: ^0.16.1
firebase_core: ^0.4.5
firebase_storage: ^3.1.6
cloud_firestore: ^0.13.7
chips_choice: ^1.2.0
cached_network_image:
modal_progress_hud: ^0.1.3
google_sign_in: ^4.5.1
font_awesome_flutter: ^8.8.1
url_launcher: ^5.5.0
dotted_border: ^1.0.6
timeago: ^2.0.26
flutter_rating_bar: ^3.0.1+1
percent_indicator: ^2.1.5
and the my assets file (images and fonts) is about 1.4 MB.
I would really appreciate your help.

First run "flutter clean" in the terminal, then try to release the apk. Normally it is bigger but flutter clean can reduce more spaces.

--release flag help you to delete log file from fat APK. try to use following command:
flutter build apk --release
and For Android,
check to build->apps->output->apk
Make sure you running android emulator.
For iOS,
flutter build ios --release
But you required valid profile certificate
Reference document

Related

Flutter app size is big because of google_ml_kit, it almost crossed 150 mb in size

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...
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 package.
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.
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.
Also: don't use an APK, but an appbundle for Android. It build way smaller binaries. For this, use:
flutter build appbundle
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
}

How do I make Flutter app open in all devices. Crashing because it couldn't find libflutter.so. How do I fix this?

So after a point of time developing my Flutter application, I find myself where my app is not opening in all architectures. I tried to see if the crash comes to Crashlytics, but understood only when we open our app next time the app will open.
I tried some of the solutions out there to keep abiFilters in ndk block of the build.gradle. Nothing worked.
yaml dependencies are
dependencies:
flutter:
sdk: flutter
http: ^0.13.3
country_code_picker: ^2.0.2
flutter_background_geolocation: ^4.0.2
shared_preferences: ^2.0.6
package_info: ^2.0.2
google_maps_flutter: ^2.0.6
provider: ^5.0.0
mixpanel_flutter: ^1.0.0
swipebuttonflutter: ^1.0.0
flutter_swipe_button: ^1.1.0
synchronized: ^3.0.0
flutter_local_notifications: ^6.0.0
firebase_core: ^1.4.0
sqflite: ^2.0.0+3
path: ^1.8.0
firebase_messaging: ^10.0.4
firebase_crashlytics: ^2.1.1
firebase_performance: ^0.7.0+7
url_launcher: ^6.0.9
dev_dependencies:
flutter_test:
sdk: flutter
And the apk structure is
Able to run it after keeping all abiFilters in defaultConfing and in release blocks in the build.gradle file.
The main reason is Flutter is building apk specific to the device that ur system is connected to. We need to close all the device connections and use the command
flutter build apk --debug or --release for release build

Flutter integration_test package conflict with my code and cannot be resolved by tweaking package versions - so the whole app cannot run

I have an app (with null-safety), and want to use integration_test package to do some testing. The pubspec.yaml looks like:
dependencies:
archive: ^3.1.2
...
dev_dependencies:
build_resolvers: ^2.0.0
build_runner: ^1.11.5
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
...
Then it errors:
Because every version of flutter_driver from sdk depends on archive 2.0.13 and my_app depends on archive ^3.1.2, flutter_driver from sdk is forbidden.
I cannot use the non-null-safety version (2.x) of archive package, because if I do so, my app code will fail to run in null safety mode! I can accept that my tests run in non-null-safety mode, but I cannot tolerate my app code run in non-null-safety mode.
Thanks for any suggestions!
You need to override the archive package version to tell flutter_driver to use the latest one:
dev_dependencies:
build_resolvers: ^2.0.0
build_runner: ^1.11.5
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
dependency_overrides:
archive: ">=3.1.2"

module 'cloud_firestore' not found (Flutter)

I am having this error when I am building my app with Xcode 'module 'cloud_firestore' not found. [enter image description here][1] I have updated my Cocoapods to 1.9.3 and I updated the flutter to 1.17.3, but still is not working and I am opening the file.xcworkspace.
Also, these are the versions of my dependencies:
flutter:
sdk: flutter
flutter_screenutil: ^1.0.2
intl: ^0.16.1
charts_flutter: ^0.8.1
flutter_picker:
git: git://github.com/yangyxd/flutter_picker.git
flutter_cupertino_data_picker: ^0.8.6
firebase_core: ^0.4.3+1
#firebase_analytics: ^5.0.9
firebase_auth: ^0.15.1
provider: ^4.0.4
flutter_spinkit: ^4.1.2
cupertino_icons: ^0.1.2
cloud_firestore: ^0.12.10
firebase_database: ^3.1.3
[1]: https://i.stack.imgur.com/ZPc71.png
from this
For anyone who is facing the problem when “Archiving” or trying to publish to the Apple Store:
Make sure to have all projects closed in Xcode
Open “Runner.xcworkspace” not runner.xcodeproj
You have to make sure that runner.xcodeproj is not open at the same time with workspace.
This is also assuming that you have run and built successfully prior to making an archive.
Update the firestore version:
cloud_firestore: ^0.13.6

Flutter crashes on hot restart and throws Error 105 on hot reload

I've been experiencing this only on ios emulator. Android works perfectly.
When I run my app I get blank white screen, but no error in console.
But when I hot reload I got this:
When I hot restart the app crashes with:
I stumbled upon similar posts and some had to do with dependencies. Most specifically firebase_messaging, however I don't use the one. I do think it maybe has to do with my flutter_localization dependency, but when I tried to run the app without it, it didn't change anything.
I also tried to change the channels and the app works on master channel but throws all sorts of other weird errors on both android and ios so I decided to stay on stable channel.
Here are my dependencies:
dependencies:
flutter:
sdk: flutter
# Localization
flutter_localizations:
sdk: flutter
firebase_auth: ^0.14.0+5
flutter_auth_buttons: ^0.6.0
firebase_storage: ^3.1.3
firebase_database: ^3.1.3
cloud_firestore: ^0.13.4+2
# Facebook Login
flutter_facebook_login: ^3.0.0
# Password Packages
flutter_password_strength: ^0.1.4
password_strength: ^0.1.2
# Font Awesome
font_awesome_flutter: ^8.7.0
# Image Picker
image_picker: ^0.6.3+4
# Money Parser
flutter_masked_text: ^0.7.0
# Google Maps
google_maps_flutter: ^0.5.25+2
#Geocode
geocoder: ^0.2.1
# Nanoid - ID generator
nanoid: ^0.1.0
# URL Launcher
url_launcher: ^5.4.2
# Charts
multi_charts: ^0.2.0
# Launcher Icons
flutter_launcher_icons: ^0.7.4
# Flare Animations
flare_flutter: ^2.0.3
dependency_overrides:
firebase_core: 0.4.4