因为sdk的flutter_driver每个版本都依赖crypto 2.1.5,Cruise依赖crypto 3.0.0,所以sdk的flutter_driver是被禁止的
Posted
技术标签:
【中文标题】因为sdk的flutter_driver每个版本都依赖crypto 2.1.5,Cruise依赖crypto 3.0.0,所以sdk的flutter_driver是被禁止的【英文标题】:Because every version of flutter_driver from sdk depends on crypto 2.1.5 and Cruise depends on crypto 3.0.0, flutter_driver from sdk is forbidden 【发布时间】:2021-06-05 11:50:51 【问题描述】:当我在 fedora 32 中编译我的项目时,显示此错误:
Running "flutter pub get" in cruise-open...
Because every version of flutter_driver from sdk depends on crypto 2.1.5 and Cruise depends on crypto 3.0.0, 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.)
这是我的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
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: 0.17.0
meta: ^1.1.8
flutter_svg: 0.19.0
logger: 0.9.4
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
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: 3.0.0
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
pull_to_refresh: 1.6.3
intl_phone_number_input: ^0.5.0
dio: 3.0.10
fish_redux: 0.3.4
hive_flutter: 0.3.1
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
我应该怎么做才能解决它?这是颤振版本信息:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/cruise-open% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Linux, locale en_US.UTF-8)
[✓] android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] IntelliJ IDEA Community Edition (version 2020.2)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)
• No issues found!
【问题讨论】:
你可以试试不设置pubspec.yaml
中的crypto
的版本吗?像这样:crypto:
。这应该可以消除版本冲突。
你找到解决办法了吗?
@Andrej 这是因为flutter_driver依赖于加密:2.1.5
我删除了 pubspec.yaml @user3875913 中的flutter_driver
啊,是的,你知道有没有办法 fork 库?
【参考方案1】:
发生这种情况是因为 flutter_driver
的 null-safety 迁移没有及时完成。
尽管现在已经修复,但要到 6 月初左右(或下一个稳定频道版本)才会在稳定频道中发布。
同时,我们有两种解决方案:
-
使用
beta
或dev
频道尽快修复。
在您的pubspec.yaml
中使用dependency_overrides
以继续在您的Flutter 2 中使用flutter_driver
(同时留在stable
频道中)。
我更喜欢第二种选择。所以我像这样编辑我的pubspec.yaml
:
dependencies:
# my list of deps...
dev_dependencies:
flutter_driver:
sdk: flutter
test: any
# my other dev_deps...
# add this section???
dependency_overrides:
convert: ^3.0.0
crypto: ^3.0.0
# add this section ???
这个解决方案对我有用。我现在可以安装flutter_driver
。 ?
这是我的参考:https://github.com/flutter/flutter/issues/77282
【讨论】:
【参考方案2】:通过将 pubspec.yaml 中的 sdk 约束更改为
environment:
sdk: ">=2.12.0 <3.0.0"
并从flutters stable频道改为master频道
【讨论】:
【参考方案3】:将crypto 添加到依赖项并运行flutter pub get
:
dependencies:
crypto: ^3.0.0
【讨论】:
问题是flutter_driver
需要 crypto: ^2.1.5
并且会失败并出现 crypto: ^3.0.0
尽管加密 3 是 Flutter 2 的空安全版本。
很高兴知道。 Tnx 注意!【参考方案4】:
使用下一个方法。但要小心,测试可能会中断。 在 pubspec.yaml 中的依赖项部分之后插入下一个代码
dependency_overrides:
crypto: 3.0.0
【讨论】:
以上是关于因为sdk的flutter_driver每个版本都依赖crypto 2.1.5,Cruise依赖crypto 3.0.0,所以sdk的flutter_driver是被禁止的的主要内容,如果未能解决你的问题,请参考以下文章
firebase 消息传递和flutter sdk 驱动程序版本解决失败
所以,因为poseapp依赖于sdk中的音频播放器^0.17.0和flutter_driver any,版本解析失败
image_size_getter 安装错误(因为来自 sdk 的 flutter_test 的每个版本都取决于集合 [...])[flutter]