【发布时间】:2021-10-20 14:29:15
【问题描述】:
我正在尝试在flutter项目中添加google_maps_flutter和google_map_location_picker来使用它,但问题是最后一个版本^4.1.7与App中的其他包不兼容,每次都会出现这个错误:
because myapp depends on both image_picker ^0.8.4+2 and google_maps_flutter ^1.1.0, version solving failed.
完全错误:
Because image_picker >=0.7.4 depends on flutter_plugin_android_lifecycle ^2.0.1 and google_maps_flutter >=0.5.22 <2.0.0-nullsafety depends on flutter_plugin_android_lifecycle ^1.0.0, image_picker >=0.7.4 is incompatible with google_maps_flutter >=0.5.22 <2.0.0-nullsafety.
So, because myapp depends on both image_picker ^0.8.4+2 and google_maps_flutter ^1.1.0, version solving failed.
pub get failed (1; So, because myapp depends on both image_picker ^0.8.4+2 and google_maps_flutter ^1.1.0, version solving failed.)
问题不仅仅存在于 image_picker 中,而是存在于 pubspec.yaml 文件中的大多数包中
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
flutter_swiper: ^1.1.6
table_calendar: ^2.1.0
google_nav_bar: ^5.0.5
line_icons: ^2.0.1
dio: ^1.0.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
fluttertoast: ^8.0.8
carousel_slider: ^4.0.0
flag: ^5.0.1
firebase_core: ^1.6.0
cloud_firestore: ^2.5.3
firebase_storage: ^10.0.4
firebase_auth: ^3.1.1
image_picker: ^0.8.4+2
xfile: ^1.1.0
getwidget: ^2.0.3
path: ^1.8.0
path_provider: ^2.0.5
cached_network_image: ^3.1.0
flutter_datetime_picker: ^1.5.1
url_launcher: ^6.0.12
google_maps_flutter: ^0.5.30
google_map_location_picker: ^3.3.4
有没有避免包版本冲突的好办法?
【问题讨论】:
-
您是否尝试更新
google_maps_flutter包?最后一个是 2.0.11 而你有 0.5.22 -
我做到了,我将 google_maps_flutter 和 google_map_location_picker 的版本都更改为最新版本,但也出现版本解决错误
-
我多次遇到这个问题,只有你能做的是更新插件冲突。如果在那之后您仍然遇到问题,您有两个选择:查找哪些版本兼容更改版本或使用其他插件(或自定义代码)。
标签: flutter google-maps