【问题标题】:Package requires Flutter SDK Version >=0.1.4 <2.0.0包需要 Flutter SDK 版本 >=0.1.4 <2.0.0
【发布时间】:2019-05-05 04:45:33
【问题描述】:

我正在尝试在我的依赖项中添加 path_provider 包,但我总是收到此错误:

The current Flutter SDK version is 0.0.0-unknown.


Because lista_tarefas depends on path_provider >=0.4.0 which requires Flutter SDK version >=0.1.4 <2.0.0, version solving failed.

pub upgrade failed (1)

我已经试过了:

  • 包获取
  • 包升级
  • 颤振升级
  • 扑干净
  • 在 pugspec.yaml 的环境变量中写入其他版本
  • 删除 pugspec.yaml 中的环境变量
  • 使用旧版本的 path_provider
  • 使 Android Studio 中的缓存失效

我当前的 pubspec.yaml 文件:

...

version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"



dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  path_provider: "^0.4.1"

dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# 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

Path_provider 文档:https://pub.dartlang.org/packages/path_provider

【问题讨论】:

  • 你是否对你的flutter下载进行了本地修改或直接从git中检查出来?
  • 如果你去 File->Settings->Languages&Frameworks->Flutter 它应该显示 SDK 和 Flutter SDK 路径。看起来不错吗?它显示的是什么版本?它是否也在版本中提到了 Dart(也许将其添加到问题中)?
  • 我已经尝试下载 path_provider 包并用实际的包替换它,但它没有工作,所以我把它放回旧的(原始的)。是的,它显示了颤振路径:C:\src\flutter,版本:颤振 0.0.0-未知 • 通道未知 • 未知来源框架 • 修订版 c27c4a265e(7 天前) • 2018-11-26 17:07:24 -0500 引擎 • 修订版 eebc6a5895 工具 • Dart 2.1.0(内部版本 2.1.0-dev.9.4 f9ebf21297)

标签: android-studio dart flutter


【解决方案1】:

您使用的path_provider包需要低于2.0.0的flutter sdk版本,并且您使用的sdk是2.0.0-dev.68.0或更高版本。您需要降级您的 sdk 或将 path_provider 包升级到兼容的包。

使用以下来降级flutter sdk

flutter version &lt;version&gt;

使用以下命令检查所有可用版本:

flutter version

以下命令告诉你当前的 sdk 版本

flutter --version 

Flutter 1.1.8 • channel unknown • unknown source
Framework • revision 985ccb6d14 (12 months ago) • 2019-01-08 13:45:55 -0800
Engine • revision 7112b72cc2
Tools • Dart 2.1.1 (build 2.1.1-dev.0.1 ec86471ccc)

【讨论】:

    【解决方案2】:

    我遇到了同样的问题。我通过进入你的flutter SDK路径中的'.git'文件夹并删除配置文件来解决它。

    【讨论】:

      【解决方案3】:

      一个解决方案可能是使用最新的 Path_Provder 包。 path_provider: ^1.6.24 另一个正在降级您的 sdk 版本,但我更喜欢前一种方法。

      【讨论】:

        猜你喜欢
        • 2019-08-03
        • 2019-10-10
        • 1970-01-01
        • 2023-02-01
        • 1970-01-01
        • 2018-12-30
        • 1970-01-01
        • 1970-01-01
        • 2021-02-04
        相关资源
        最近更新 更多