当前Flutter SDK版本为0.0.0-未知

Iro*_*nic 14 flutter

我没有使用GIT。正如我看到的一些帖子/问题,用户提到他们正在使用 GIT,因此他们收到了错误。

\n\n

昨天,我添加了 Image Cropper Plugin,然后重新启动了机器。重新启动后,它开始给出错误。

\n\n
The current Flutter SDK version is 0.0.0-unknown.\n\nBecause image_cropper 1.2.1 requires Flutter SDK version ^1.12.13 and no versions of image_cropper match >1.2.1 <2.0.0, image_cropper ^1.2.1 is forbidden.\nSo, because demoapp depends on image_cropper ^1.2.1, version solving failed.\npub get failed (1; So, because demoapp depends on image_cropper ^1.2.1, version solving failed.)\nExited (1)\n
Run Code Online (Sandbox Code Playgroud)\n\n

我运行 Flutter version 命令 -> 下面是输出。

\n\n
Flutter 1.12.13+hotfix.9 \xe2\x80\xa2 channel stable \xe2\x80\xa2 https://github.com/flutter/flutter.git\nFramework \xe2\x80\xa2 revision f139b11009 (6 weeks ago) \xe2\x80\xa2 2020-03-30 13:57:30 -0700\nEngine \xe2\x80\xa2 revision af51afceb8\nTools \xe2\x80\xa2 Dart 2.7.2\n
Run Code Online (Sandbox Code Playgroud)\n\n

我做了 Flutter Clean 和 Flutter Pub Get 他们都没有解决问题。

\n\n

我运行 Flutter Doctor,这是输出。

\n\n
flutter doctor\nDoctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.3 19D76, locale en-IN)\n\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 28.0.3)\n[\xe2\x9c\x97] Xcode - develop for iOS and macOS\n    \xe2\x9c\x97 Xcode installation is incomplete; a full installation is necessary for iOS development.\n      Download at: https://developer.apple.com/xcode/download/\n      Or install Xcode via the App Store.\n      Once installed, run:\n        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer\n        sudo xcodebuild -runFirstLaunch\n    \xe2\x9c\x97 CocoaPods not installed.\n        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the\n        Dart side.\n        Without CocoaPods, plugins will not work on iOS or macOS.\n        For more info, see https://flutter.dev/platform-plugins\n      To install:\n        sudo gem install cocoapods\n[\xe2\x9c\x93] Android Studio (version 3.1)\n[\xe2\x9c\x93] VS Code (version 1.44.2)\n[\xe2\x9c\x93] Connected device (1 available)\n\n! Doctor found issues in 1 category.\n
Run Code Online (Sandbox Code Playgroud)\n\n

我从一开始就没有使用 Xcode。

\n\n

有关如何解决此问题的任何建议。

\n\n

编辑

\n\n

我通过运行 echo $PATH 检查了路径。

\n\n
/Users/rahul/Desktop/flutter/bin\n
Run Code Online (Sandbox Code Playgroud)\n\n

路径也在那里。

\n\n

编辑 2 \nFlutter Upgrade 也没有帮助。

\n

Nik*_*oni 5

颤振 SDK 文件

  1. 首先重新启动系统。
  2. 打开下载的 Flutter SDK zip文件夹(从官网下载 flutter sdk 时获得的文件夹)并复制 <flutter_windows_1.22.5-stable.zip\flutter.git> 文件夹下的 Packed-refs 和 config 文件
  3. 从系统中现有的 flutter sdk 位置(您之前提取的)中删除这两个文件,然后再次粘贴这些文件。
  4. 再次打开 android studio,然后单击“获取依赖项”按钮重试。
  5. 单击运行应用程序。
  6. 应用程序将成功运行。

  • 我没有任何文件,只有 HEAD 文件和这 5 个文件夹。我应该怎么办? (2认同)

Uda*_*han -3

转到flutter_image_cropper 包的github 页面,在您的空间中分叉它,然后在其 pubspec.yaml 文件中更改其 sdk 要求,提交它,推送它,现在在您的项目中,在导入此包时,提供您的 github 链接的路径以 .git 结尾的分叉存储库。它将完美地工作。

您也可以参考Github 页面了解常见问题