I have this dependency conflict:
$ flutter pub upgrade --dry-run
Resolving dependencies...
Because image >=2.1.14 <3.0.0-nullsafety.0 depends on archive ^2.0.0 and image >=2.0.4 <2.1.14 depends on archive >=1.0.16 <3.0.0, image >=2.0.4 <3.0.0-nullsafety.0 requires archive >=1.0.16 <3.0.0.
And because flutter_launcher_icons >=0.7.1 <0.9.0 depends on image ^2.1.1 and every version of flutter_driver from sdk depends on archive 3.1.2, flutter_launcher_icons >=0.7.1 <0.9.0 is incompatible with flutter_driver from sdk.
So, because gallery depends on both flutter_driver any from sdk and flutter_launcher_icons ^0.8.1, version solving failed.
pub finished with exit code 1
Versions
$ dart --version
Dart SDK version: 2.13.0-222.0.dev (dev) (Fri Apr 9 12:15:17 2021 -0700) on "macos_x64"
$ flutter --version
Flutter 2.1.0-13.0.pre.574 • channel master • https://github.com/flutter/flutter
Framework • revision 02efffc134 (2 days ago) • 2021-04-10 03:49:01 -0400
Engine • revision 8863afff16
Tools • Dart 2.13.0 (build 2.13.0-222.0.dev)
pubspec.yaml
name: gallery
description: A resource to help developers evaluate and use Flutter.
repository: https://github.com/flutter/gallery
version: 2.8.1+020801
environment:
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: ">=0.16.1 <=0.17.0"
flutter_localized_locales: ">=1.1.1 <=2.0.0"
cupertino_icons: ^1.0.0
rally_assets: ^2.0.0
meta: ^1.1.8
scoped_model: ^1.1.0
shrine_images: ^1.1.2
url_launcher: ^5.6.0
vector_math: ^2.0.8
collection: ^1.14.0
flutter_gallery_assets: ^0.2.6
package_info: ^0.4.0
google_fonts: ^1.1.2
flutter_staggered_grid_view: ^0.3.3
animations: ^1.1.2
provider: ^4.3.2
adaptive_breakpoints: ^0.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
test:
path:
args:
grinder: ^0.8.0
pedantic: ^1.9.0
string_scanner: ^1.0.5
web_benchmarks: ^0.0.3
flutter_launcher_icons: "^0.8.1"
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/logo/roof.png"
flutter:
assets:
- packages/flutter_gallery_assets/assets/studies/shrine_card_dark.png
- ...
...
Tried
I changed:
flutter_launcher_icons: "^0.8.1"
to:
flutter_launcher_icons: "^0.9.0"
But it couldn't help.
Question
I cannot figure out how to resolve the conflict. Is there a standard way for such conflict resolutions which I might be missing?
you can run in your project terminal
flutter pub upgrade --major-versions
Because your project depends on flutter_launcher_icons and flutter_driver
and both packages depend on the third package archive with different versions.
flutter_launcher_icons: "^0.8.1" depends on archive: ">=2.0.4 <3.0.0-nullsafety.0" and flutter_driver from sdk depends on archive: 3.1.2, So there is conflict of resolving version of archive package.
So to resolve this conflict you have to add the manual entry in pubspec.yaml file of your project.
dependency_overrides:
archive: 3.1.2 //any version you want for resolution.
And to know how to flutter resolves dependencies, check the below link.
https://medium.com/cashify-engineering/flutter-dependencies-resolution-2faecdbfce03
this link also describes a standard way of resolving such dependency conflict.
Related
Hoping you can help me out here. This project used to build without errors but then I updated Flutter and now I get this build error. Any quick help is greatly appreciated because I am hoping to build this and make a TestFlight release a.s.a.p to make a pitch. just FYI similar error when performing app bundle for Android.
I am not using maxLength or maxLengthEnforcment in my code at all. So, I think the has to do with a dependency related flutter_typeahead or another one from the yaml. Anyway, grateful for any help!
I tried updating dependency of flutter_typeahead to a higher versions.
I did a "flutter clean"
I did a "flutter pub upgrade"
Failed to build iOS app
Error (Xcode): ../../../.pub-cache/hosted/pub.dev/flutter_typeahead-1.9.3/lib/flutter_typeahead.dart:934:9: Error: No named parameter with the name 'maxLengthEnforced'.
This is my Flutter environment details:
Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9944297138 (6 days ago) • 2023-02-08 15:46:04 -0800
Engine • revision 248290d6d5
Tools • Dart 2.19.2 • DevTools 2.20.1
This is my pubspec.yaml:
name: app
description: A new Flutter project.
publish_to: 'none'
version: 0.0.91+4flutter
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
#firebase_core: ^0.5.0
pedantic: 1.9.0
google_fonts: ^1.1.0
hooks_riverpod: ^0.11.1
google_maps_flutter: ^1.0.2
flutter_typeahead: ^1.9.3
freezed_annotation: ^0.12.0
hive_flutter: ^0.3.1
http: ^0.12.2
multi_image_picker: ^4.7.14
maps_launcher: ^1.2.2+1
smooth_page_indicator: ^0.2.0
preload_page_view: ^0.1.4
charts_flutter: ^0.9.0
file: ^6.1.4
dev_dependencies:
flutter_test:
sdk: flutter
freezed: ^0.12.1
build_runner: any
analyzer: 0.39.14
json_serializable: ^3.5.0
flutter_launcher_icons: ^0.8.1
flutter:
uses-material-design: true
assets:
- assets/house.png
- assets/car.png
- assets/team.png
- assets/logo_transparent.png
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon2.png"
I have downloaded flutter_windows_2.0.5-stable.zip and installed Flutter 2.0.5.
When I run a v1.24.0 project, I get the following output:
Running "flutter pub get" in get_json ...
The current Dart SDK version is 2.12.0-29.10.beta.
Because flutter_easyloading 3.0.0 requires SDK version >=2.12.0 <3.0.0 and no versions of flutter_easyloading match >3.0.0 <4.0.0, flutter_easyloading ^3.0.0 is forbidden.
So, because get_json depends on flutter_easyloading ^3.0.0, version solving failed.
pub get failed (1; So, because get_json depends on flutter_easyloading ^3.0.0, version solving failed.)
Contents of pubspec.yaml:
dependencies:
flutter:
sdk: flutter
http: ^0.12.2
json_annotation: ^2.0.0 #^4.0.1
rflutter_alert: ^1.1.0 #^2.0.2
pdf_flutter: ^1.1.4
syncfusion_flutter_pdfviewer: ^18.4.49-beta
webview_flutter: ^1.0.7 #^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
json_serializable: ^2.0.0 #^4.1.1
Looking around the Internet I found
Update to/install latest Flutter packages (pubspec.yaml)
At the end of this it is stated that in Flutter 2 it will help to run
1 flutter pub outdated and
2 flutter pub upgrade --major-versions
Running 1 "flutter pub outdated" gives a looot of output and ends with:
Changed 75 dependencies!
25 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
No changes to pubspec.yaml!
Running 2 "flutter pub upgrade --major-versions" also gives a lot of output and ends with:
...
No dependencies changed.
25 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Changed 4 constraints in pubspec.yaml:
json_annotation: ^2.0.0 -> ^4.0.1
rflutter_alert: ^1.1.0 -> ^2.0.2
webview_flutter: ^1.0.7 -> ^2.0.4
json_serializable: ^2.0.0 -> ^4.1.1
pubspec.yaml was changed to:
dependencies:
flutter:
sdk: flutter
http: ^0.12.2
json_annotation: ^4.0.1 #^4.0.1
rflutter_alert: ^2.0.2 #^2.0.2
pdf_flutter: ^1.1.4
syncfusion_flutter_pdfviewer: ^18.4.49-beta
webview_flutter: ^2.0.4 #^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
json_serializable: ^4.1.1 #^4.1.1
Now I try run my (old) project again which results in the following output:
Running "flutter pub get" in get_json...
The current Dart SDK version is 2.12.0-29.10.beta.
Because no versions of json_serializable match >4.1.1 <5.0.0 and json_serializable 4.1.1 requires SDK version >=2.12.0 <3.0.0, json_serializable ^4.1.1 is forbidden.
So, because get_json depends on json_serializable ^4.1.1, version solving failed.
pub get failed (1; So, because get_json depends on json_serializable ^4.1.1, version solving failed.)
I have tried many variations of what is described above, but I am stuck.
Can anyone help or guide me in the right direction? Thank you.
==============================
Thank you to Ujjwal Raijada. I got Flutter 2 because of web support and did not think of null safety. However, I have now followed the migration guide to the detail and now have the following pubspec.yaml:
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
http: ^0.13.1
json_annotation: ^4.0.1
rflutter_alert: ^2.0.2
#pdf_flutter: ^1.1.4 # Package pdf_flutter is not null safe and therefore cannot be used ...
syncfusion_flutter_pdfviewer: ^19.1.57-beta
webview_flutter: ^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^2.0.1
json_serializable: ^4.1.1
I have also changed my code as suggested by the migration guide. so now I run "flutter packages pub run build_runner build" which results in:
The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again.
pub finished with exit code 65
Pressing "pub get" in pubspec.yaml gives the following result:
The current Dart SDK version is 2.12.0-29.10.beta.
Because get_json requires SDK version >=2.12.0 <3.0.0, version solving failed.
pub get failed (1; Because get_json requires SDK version >=2.12.0 <3.0.0, version solving failed.)
Process finished with exit code 1
What should I do now? Any help out there? Thank you.
The current Dart SDK version is 2.10.5.
Because path_provider 2.0.1 requires SDK version >=2.12.0-259.9.beta <3.0.0 and no versions of path_provider match >2.0.1 <3.0.0, path_provider ^2.0.1 is forbidden.
So, because harmonoid depends on path_provider ^2.0.1, version solving failed.
pub get failed (1; So, because harmonoid depends on path_provider ^2.0.1, version solving failed.)
How do i solved this error? this is my pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.8.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
animations: ^1.1.2
provider: ^4.3.3
assets_audio_player:
git: https://github.com/alexmercerind/Flutter-AssetsAudioPlayer
media_metadata_retriever: ^0.0.2+1
http: ^0.12.2
path: ^1.7.0
path_provider: ^2.0.1
flutter_local_notifications: ^3.0.3
url_launcher: ^5.5.0
permission_handler: ^5.0.1+1
share: ^0.6.5+4
palette_generator: ^0.2.3
implicitly_animated_reorderable_list: ^0.3.2
dev_dependencies:
flutter_test:
sdk: flutter
error
My Dart SDK version is 2.12.0, and the Flutter version is 2.0.1. I created a new project and copied all your dependencies. The project worked without any problems.
For saving your time, I recommend upgrading to the stable channel and Flutter 2 using these commands or this link.
flutter channel stable
flutter upgrade
If you don't want to migrate your Flutter and Dard SDK versions yet,
I would recommend you to try and remove the version from the line:
path_provider: ^2.0.1
so it would look like this: path_provider:
run: pub get again
run your project again
Eventually I would recomment to migrate to the newest version of the SDKs and upgrade all your dependencies. This is just a temporary solution.
When I compile my project, it shows this error:
Running "flutter pub get" in cruise-open...
Because every version of flutter_driver from sdk depends on crypto 3.0.0 and Cruise depends on crypto 2.1.3, flutter_driver from sdk is forbidden.
So, because Cruise depends on flutter_driver any from sdk, version solving failed.
pub get failed (1; So, because Cruise depends on flutter_driver any from sdk, version solving failed.)
I have tried each version of crypto but still not fix my problem, what should I do to solve it? This is my pubspec.yaml:
name: Cruise
description: A RSS article read Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: 0.16.1
meta: ^1.1.8
flutter_svg: 0.19.0
logger: 0.9.4
marquee: ^1.7.0
scoped_model: ^1.1.0
shrine_images: ^1.1.2
flare_dart: 2.3.4
flare_flutter: ^2.0.2
vector_math: ^2.0.8
collection: ^1.14.0
package_info: ^0.4.0
fluttertoast: 7.1.6
google_fonts: 1.0.0
flutter_staggered_grid_view: ^0.3.0
adaptive_breakpoints: ^0.0.2
cupertino_icons: 1.0.0
http: ^0.12.0+2
flutter_icons: ^1.0.0
timeago: 2.0.26
animations: 1.1.2
flutter_hooks: ^0.12.0
share: ^0.6.4+3
shimmer: 1.1.1
crypto: 2.1.3
url_launcher: 5.5.0
uni_links: 0.4.0
flutter_html: 1.2.0
shared_preferences: ^0.5.8
state_notifier: ^0.5.0
flutter_secure_storage: 3.3.3
flutter_slidable: "^0.5.5"
hive: ^1.4.1+1
#fluwx: ^2.4.1
pull_to_refresh: 1.6.3
intl_phone_number_input: ^0.5.0
dio: 3.0.10
fish_redux: 0.3.4
hive_flutter:
git:
url: https://github.com/hivedb/hive.git
path: hive_flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
test:
path:
args:
grinder: ^0.8.0
pedantic: ^1.9.0
string_scanner: ^1.0.5
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
generate: true
The problem lies here crypto: 2.1.3. You need to update it to the latest version i. e. crypto: ^3.0.0.
This should solve your issue.
What happens is that when you use so many packages, some of those packages use some other packages. It may so happen that two or more packages use the same package.
In your case, the package flutter_driver uses the package crypto. And you yourself are using the package crypto but a different version of it. So, it creates an error because you cannot have two different versions of the same package.
I am trying to install image_picker and firbase_storage in my flutter project. But whatever version I try to install, it fails. and gives error like this -
Because image_picker >=0.3.0 requires Flutter SDK version >=0.1.4 <2.0.0 and image_picker <0.3.0 requires SDK version >=1.8.0 <2.0.0, image_picker is forbidden.
I have tried out installing every version but not able to install even a single version.
Flutter doctor -v is working fine and following is the content of my pubspec.yaml file
name: timepass
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter_secure_storage: ^3.1.3
image_picker: ^0.1.4
firebase_storage: ^0.2.0
location: ^1.4.1
graphql_flutter: ^0.9.1
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
One way to approach this kind of dependency issues is that just let the pub to fetch the appropriate version if you are facing any issues or conflicts with dependency.
Add the dependency on pubspec.yaml as below
dependencies:
image_picker: any
or
dependencies:
image_picker:
Then check the pubspec.lock file and find the version number.
In this case, you may get
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
Then you can modify pubspec.yaml as
dependencies:
image_picker: ^0.5.0
You need to allow a newer image_picker version.
Try
dependencies:
image_picker:
or
dependencies:
image_picker: ^0.5.0