首页 > 解决方案 > 如何在 Android Studio 中升级 http 依赖

问题描述

颤振酒吧得到:

Because firebase_auth >=1.0.0 depends on firebase_auth_web ^1.0.0 which depends on http_parser ^4.0.0, firebase_auth >=1.0.0 require
s http_parser ^4.0.0.
And because http 0.12.2 depends on http_parser >=0.0.1 <4.0.0 and no versions of http match >0.12.2 <0.13.0, firebase_auth >=1.0.0 i
s incompatible with http ^0.12.2.
So, because p1 depends on both http ^0.12.2 and firebase_auth ^1.0.0, version solving failed.
Running "flutter pub get" in p1...
pub get failed (1; So, because p1 depends on both http ^0.12.2 and firebase_auth ^1.0.0, version solving failed.)

我刚刚运行了颤振升级,所以我的颤振和飞镖包是最新的,并且通过 sdk 管理器(在工具中)我安装了 android 10 和 11 以及所需的 sdk 工具。Android Studio 没有待处理的开发频道更新。(2021 年 3 月 5 日)Firebase 版本就在昨天才包含在内。

dependencies:
  http: "^0.12.2"
  flutter:
    sdk: flutter


 
  cupertino_icons: ^1.0.0
  firebase_core: ^1.0.0
  firebase_auth: ^1.0.0
  firebase_database: ^6.1.0

如果我在我的眼皮底下遗漏了什么,我深表歉意。

编辑:是的,我完全错过了它。我只需要在 pub.get 中查找 http 然后更改版本。(最新:http:“^0.13.0”)如果需要,请删除。

标签: androidfirebaseflutterandroid-studioupgrade

解决方案


解决方案:我将依赖项(pubspec.yaml)中的http版本从旧版本更改为http:“^0.13.0”(最新截至2021年3月5日)(从pub.dev获取版本并输入http,go到安装选项卡,你会在那里找到版本)。

然后运行flutter pub get,或者任何适合你需要的东西。

我当前的依赖项:

dependencies:
  http: "^0.13.0"
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0
  firebase_core: ^1.0.0
  firebase_auth: ^1.0.0
  firebase_database: ^6.1.0

如果其他人想分享任何相关的东西,请做!谢谢你。


推荐阅读