Flutter not able to build release version of application - flutter

flutter run works but flutter run --release or flutter run --release --profile returns the error below:
===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=1, si_addr=0x0
version=2.18.6 (stable) (Tue Dec 13 21:15:14 2022 +0000) on "macos_simarm64"
pid=14192, thread=-1, isolate_group=isolate(0x7f910c011200), isolate=(nil)(0x0)
isolate_instructions=0, vm_instructions=0
Stack dump aborted because InitialRegisterCheck failed.
Dart snapshot generator failed with exit code -6
Here's my pubspec.yaml dependencies:
version: 1.0.0+1
environment:
sdk: ">=2.15.1 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
flutter_native_splash: ^2.1.6
table_calendar: ^3.0.8
image_stack: ^2.1.1
intl: ^0.17.0
shimmer: ^2.0.0
flutter_riverpod: ^1.0.4
auto_route: ^5.0.4
google_fonts: ^3.0.1
pinput: ^2.2.9
mask_text_input_formatter: ^2.3.0
firebase_core: ^1.21.1
dio: ^4.0.6
dio_cache_interceptor: ^3.2.7
dio_cache_interceptor_hive_store: ^3.1.1
http: ^0.13.5
enum_to_string: ^2.0.1
mobile_scanner: ^2.1.0
firebase_auth: ^3.3.19
image_picker: ^0.8.5+3
image_cropper: ^3.0.1
firebase_storage: ^10.2.18
fluttertoast: ^8.0.9
firebase_messaging: ^13.0.1
hive: ^2.2.1
hive_flutter: ^1.1.0
flutter_hooks: ^0.18.5+1
hooks_riverpod: ^1.0.4
local_auth: ^2.1.0
lottie: ^2.1.0
flutter_local_notifications: ^9.7.0
device_info_plus: ^4.0.1
timeago: ^3.2.2
url_launcher: ^6.1.5
focused_menu: ^1.0.5
rxdart: ^0.27.7
rate_my_app: ^1.1.3
infinite_scroll_pagination: ^3.2.0
flutter_offline: ^2.1.0
webview_flutter: ^4.0.1
shared_preferences: ^2.0.15
web_socket_channel: ^2.2.0
fl_chart: ^0.55.2
dev_dependencies:
#flutter_gen_runner:
auto_route_generator: ^5.0.2
firebase_core_platform_interface: ^4.5.1
build_runner: any
flutter_lints: ^2.0.1
flutter_launcher_icons: ^0.11.0
flutter_test:
sdk: flutter
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icons/b2b_logo.png"
flutter:
uses-material-design: true
generate: true
assets:
- assets/images/
- assets/
- assets/animations/
- assets/icons/
fonts:
- family: SnagIcons
fonts:
- asset: assets/fonts/SnagIcons.ttf</summary>
The application from 2 months ago was building successfully but as of last week, I have been getting this issue and reverting the changes i still get the same issue.

Try to switch to flutter dev channel and back to flutter stable.
Do a flutter clean and flutter pub get and try it again.

This occours because of the some updates in the packages
Try entering the below code in the vs code terminal:
flutter clean
flutter pub get
Your flutter code will work like a charm!
Edit:
There are github issues which address this,see if any works for you
https://github.com/flutter/flutter/issues/43707
https://github.com/flutter/flutter/issues/109818
https://github.com/flutter/flutter/issues/43597

So, after raising the issue on the flutter channel, the problem was caused by returning a late variable from a future method so there was a fix in the release of flutter 3.7 which will remedy this problem
You can view the issue here on GitHub

Related

Flutter path_provider issue

I upgraded flutter and dart recently and unexpectedly encountered this error. Everything was fine, I just re-started the project and the error was there!
Error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':path_provider_android:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
My pubspec.yml dependencies:
dependencies:
auto_animated: any
awesome_dialog: ^2.1.1
cached_network_image: ^3.0.0
carousel_slider: ^3.0.0
circular_countdown_timer: ^0.2.0
cupertino_icons: ^1.0.0
dropdown_search: ^2.0.1
dropdownfield: ^1.0.3
email_validator: ^2.0.1
expandable: ^5.0.1
firebase_core: ^1.10.2
firebase_messaging: ^11.2.0
flutter:
sdk: flutter
flutter_animator: ^3.2.0
flutter_html: ^0.8.2
flutter_launcher_icons: any
flutter_local_notifications: ^6.0.0
flutter_spinkit: ^5.0.0
flutter_tags: ^0.4.9+1
flutter_zoom_drawer: ^2.1.1
google_fonts: any
http: ^0.13.1
image: ^3.0.2
image_picker: ^0.7.4
image_size_getter: ^1.0.0
intl: ^0.17.0
material_design_icons_flutter: 4.0.5955
mime: ^1.0.0
page_transition: ^1.0.9
progress_indicators: ^1.0.0
provider: ^6.0.1
shared_preferences: ^2.0.6
swipe_cards: ^0.1.0
syncfusion_flutter_datepicker: ^19.3.56
textfield_tags: ^1.1.1
upgrader: ^3.3.0
url_launcher: ^6.0.3
webview_flutter: ^0.3.0
path_provider: ^2.0.1
open_file: ^3.1.0
What I've tried:
flutter upgrade
Flutter clean and flutter get
Changing min SDK version
The problem was solved after I reinstalled flutter and created a project from scratch and copied my older code. Also, Firebase is now only compatible if you have the min SDK version of 19.
I solved it by upgrading the AndroidStudio Version,It maybe caused by the low version of development tool,

How to get the matching version of shared preferences, upgradder and other packages?

I have a problem on matters upgrader, it's seems i can't build my apps when it come to difference version off package
here is the problem
Running "flutter pub get" in Mobile7Merge...
Because requests 3.3.0 depends on shared_preferences ^0.5.2 and no versions of requests match >3.3.0 <4.0.0, requests ^3.3.0 requires shared_preferences ^0.5.2.
So, because mobile7 depends on both requests ^3.3.0 and shared_preferences ^2.0.3, version solving failed.
pub get failed (1; So, because mobile7 depends on both requests ^3.3.0 and shared_preferences ^2.0.3, version solving failed.)
here is my pubspec.yaml
name: mobile7
description: Mobile 7
version: 1.0.0+1
environment:
sdk: ">=2.5.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.1
lazy_load_scrollview: ^1.1.0
flutter_appauth: ^0.9.1
flutter_secure_storage: ^3.3.3
fl_chart: ^0.10.1
flutter_datetime_picker: ^1.3.8
intl: ^0.16.1
google_nav_bar: ^2.2.0
line_icons: ^0.2.0
google_fonts: ^1.1.0
equatable: ^1.2.5
bloc: ^6.0.3
flutter_bloc: ^6.0.5
rxdart: ^0.23.1
expandable: ^4.1.4
jiffy: ^3.0.1
requests: ^3.3.0
flutter_html: ^1.0.0
webview_flutter: any
flutter_downloader: ^1.4.4
path_provider: ^1.6.24
permission_handler: ^5.0.1
fluttertoast: ^7.1.1
# flutter_cached_pdfview: ^0.3.0
# flutter_pdfview: ^1.0.0+10
upgrader: ^3.0.0
dio: any
advance_pdf_viewer: ^1.2.0
pinch_zoom: ^0.0.4
dart_date: ^1.0.7
flutter_inappwebview: ^4.0.0+4
shared_preferences: ^2.0.3
# shared_preferences: ^0.5.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
I thought to have two package at the same time, that is 2.0.3 and 0.5.2 but either any of them have solve my problem, i tried to search if i can use two package with the same name but mainly, thos shared_preference are inside request package and upgrader package, i tried to include there on my own
How can i solve this??
Managing dependencies can be a pain some times but I have found this commands can be useful:
flutter pub outdated https://dart.dev/tools/pub/cmd/pub-outdated
flutter pub upgrade --major-versions https://dart.dev/tools/pub/cmd/pub-upgrade#--major-versions

Getting ios/Runner/GeneratedPluginRegistrant while running Flutter iOS build. Card Scanner working fine on Android

I am getting Error when try to run Flutter run iOS. Error is 'ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'card_scanner' not found #import card_scanner;'. Card Scanner package link
I have already done these things
Flutter clean
Pod deintegrate
Pod init
Pod install
Comment use framework! at Podfile
Here are my dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
device_info: 0.4.0+1
material_design_icons_flutter: ^4.0.5755
provider: 3.0.0
intl: ^0.16.1
http: ^0.12.2
shared_preferences: ^0.5.12+4
fluttertoast: ^7.1.1
flutter_launcher_icons: ^0.8.0
url_launcher: ^5.7.10
sqflite: ^1.3.0
path_provider: ^1.6.24
path_provider_macos: ^0.0.1
connectivity: ^2.0.2
flutter_secure_storage: ^3.3.5
flutter_google_places: ^0.2.6
async: ^2.4.2
flutter_credit_card: ^0.1.4
stripe_payment: ^1.0.9
progress_dialog: ^1.2.4
intercom_flutter: ^2.3.3
firebase_messaging: ^7.0.3
change_app_package_name: ^0.1.2
permission_handler: 5.1.0+2
card_scanner: ^0.2.0+3

Problem in importing some Flutter package

I can't import the firebase_auth package in Flutter. I did everything they said in the installation part (as shown below). Other packages are imported and working properly, but firebase_auth isn't.
name: flash_chat
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0<3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
animated_text_kit: ^2.2.0
firebase_core: ^0.5.0
firebase_auth_platform_interface: ^2.0.1
firebase_auth_web: ^0.3.0+1
firebase_core_platform_interface: ^2.0.0
cloud_firestore: ^0.14.0+2
firebase_analytics: ^6.0.0
firebase_messaging: ^7.0.0
firebase_auth: ^0.18.0+1
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
And I did the pub get. Can anybody help me?
These are a few suggested solutions:
Reload your IDE
Delete your pubspec.lock file and re run pub get.

App Crash when Launch after adding flutter firebase_admob

i just add new dependencies to pubspec.yaml, it's firebase_admob: ^0.8.0+3 but after adding it i got app crash at launch.
here're my other dependencies, any idea to solve ?
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
shared_preferences: ^0.5.1+1
rxdart: ^0.20.0
font_awesome_flutter: ^8.2.0
geolocator: '^3.0.0'
localstorage: ^1.2.0
crypto: ^2.0.6
dio: ^2.0.0
pigment: ^1.0.3
validate: ^1.6.0
hijri: ^0.2.5
device_id: ^0.1.3
vibrate: ^0.0.4
date_format: ^1.0.5
cron: ^0.2.1
audioplayers: ^0.9.0
google_fonts_arabic: ^1.1.7
unicode: ^0.1.0
flutter_html: ^0.8.2
flutter_compass: ^0.1.0
google_sign_in: ^4.0.1+1
http: ^0.11.3+16
easy_alert: ^0.0.2
google_maps_flutter: ^0.2.0
app_settings: ^1.0.5
flutter_local_notifications: ^0.5.0
cached_network_image: ^0.6.0
firebase_admob: ^0.8.0+3
flutter_facebook_login:
git:
url: https://github.com/roughike/flutter_facebook_login
ref: e69fef3
firebase_auth: ^0.8.2
esys_flutter_share: ^0.0.9
dev_dependencies:
flutter_test:
sdk: flutter
I need to see error messages but probably it’s about Android X. Reduce the package version or migrate your project to android x.
Another related question
Change log: