【问题标题】:Flutter version solving failed,google_map_location_pickerFlutter 版本解决失败,google_map_location_picker
【发布时间】: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


【解决方案1】:

用此代码替换 pubyaml 插件版本。这将消除冲突。

  cupertino_icons: ^1.0.2
  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.
  fluttertoast: ^8.0.8
  carousel_slider: ^4.0.0
  flag: ^5.0.1
  firebase_core: ^0.5.3
  cloud_firestore: ^0.5.0
  firebase_storage: ^5.0.1
  firebase_auth: ^0.6.2+1
  image_picker: 0.8.0+4
  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.5
  google_maps_flutter: ^2.0.10
  google_map_location_picker: ^4.1.7

【讨论】:

  • 我收到此错误:插件cloud_firestore, firebase_auth, google_map_location_picker 使用了已弃用的 Android 嵌入版本。
  • @MohamedAmin 这不是错误,而是警告。如果要删除警告。将所有依赖项更新到最新版本。但是如果您之前已经对应用程序进行了编码。这会做。如果解决了问题,请接受答案。
猜你喜欢
  • 2021-07-25
  • 2019-07-30
  • 2021-05-09
  • 2021-12-07
  • 2021-04-01
  • 2021-09-24
  • 2019-09-27
  • 2021-09-28
  • 2021-07-08
相关资源
最近更新 更多