在 pubspec.yaml 中,如果我使用 firebase_core 和 firebase_messaging 的以下依赖项:
dependencies:
firebase_core: ^0.7.0
firebase_messaging: ^7.0.3
我收到以下错误消息:
Because firebase_messaging >=7.0.3 <8.0.0-dev.7 depends on firebase_core ^0.5.0+1 and yourApp depends on firebase_core ^0.7.0, firebase_messaging >=7.0.3 <8.0.0-dev.7 is forbidden.
So, because youApp depends on firebase_messaging ^7.0.3, version solving failed.
pub get failed (1; So, because chat_app depends on firebase_messaging ^7.0.3, version solving failed.)
答案 0 :(得分:2)
根据 FlutterFire 的迁移指南更新您的 pubspec.yaml: https://firebase.flutter.dev/docs/migration/
注意:在撰写本文时,FlutterFire 迁移指南并未使用 firebase_core 0.7.0 和 firebase_messaging 7.0.0 编译,即为什么我建议使用 firebase_messaging 8.0.0-dev :
dependencies:
firebase_core: ^0.7.0
firebase_messaging: ^8.0.0-dev.14
答案 1 :(得分:1)
尝试清理并删除pubspec.lock(请备份)
flutter clean
pub cache repair // optional
然后更新您的pubspec.yaml,这对我有用(Y)
dependencies:
firebase_core: ^0.7.0
firebase_messaging: ^8.0.0-dev.14
答案 2 :(得分:0)
就去做
dependencies:
firebase_core: ^0.7.0
firebase_messaging:
它将使用最新版本的 firebase_messaging