因为 sdk 中的 flutter_driver 的每个版本都依赖于 crypto 3.0.0 而 Cruise 依赖于 crypto 2.1.3,所以 sdk 中的 flutter_driver 是被禁止的

时间:2021-02-25 12:01:19

标签: flutter

当我编译我的项目时,它显示了这个错误:

 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.)

我已经尝试了 crypto 的每个版本,但仍然无法解决我的问题,我应该怎么做才能解决它?这是我的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

1 个答案:

答案 0 :(得分:2)

问题出在这里crypto: 2.1.3。您需要将其更新到最新版本 i。 e. crypto: ^3.0.0

这应该可以解决您的问题。 发生的情况是,当您使用这么多包时,其中一些包会使用其他一些包。可能有两个或多个包使用同一个包。

在您的情况下,包 flutter_driver 使用包 crypto。而您自己正在使用包 crypto 但它的不同版本。因此,它会创建一个错误,因为您不能拥有同一个包的两个不同版本。