升级失败后,命令不起作用

时间:2019-06-20 08:01:57

标签: flutter upgrade

由于最低v1.5 sdk插件的需要,我使用flutter升级,但是由于我无法使用命令……我没有找到bash命令,

当我使用Flutter Doctor时,我尝试手动下载1.5 sdk并替换以前的文件夹,他说我有1.2.1 ...我试图重新升级,但出现此错误:

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is
recommended that you stash them via "git stash" or else commit the changes to a local branch. If it is okay to remove
local changes, then re-run this command with --force.




C:\Users\utilisateur>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [version 10.0.17134.829], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[!] VS Code, 64-bit edition (version 1.21.1)
    X Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)

! Doctor found issues in 1 category.

我尝试了git clean -xfd

我有...

C:\Users\utilisateur>git clean -xfd
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again?
(y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? (y/ngit stash save --keep-index
) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try againgit stash save --keep-index
? (y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? git stash save --keep-index
(y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? (y/n)

4 个答案:

答案 0 :(得分:2)

所以我遇到了同样的问题。这可能是因为我在E:\目录而不是默认的C:\目录中安装了Flutter SDK。 这就是我解决的方法,

1:检查Flutter Sdk的位置。您可以通过创建“新建项目-> Flutter-> Flutter Sdk”来完成此操作(如果您已安装并配置了Flutter Sdk,则此方法有效;如果未安装,则可以在同一“新的Project-> Flutter”窗口。

2:然后通过在IDE的右下角打开终端,然后单击终端。

3:键入“ cd _yourSdkLocation \ bin”,将目录更改为flutter sdk的bin位置。在这里,将“ _yourSdkLocation”替换为颤动的SDK所在的目录地址。

4:然后运行“ flutter upgrade --force”

希望这会有所帮助。 :)

答案 1 :(得分:1)

为简单起见,您可以将flutter sdk提取到文件夹“ c:\ Flutter”中,然后设置路径

Windows | iOS

删除您创建的旧Flutter SDK文件夹。然后按照步骤illustrated here将Android Studio指向新的Flutter SDK安装。 enter image description here

答案 2 :(得分:1)

在Android Studio或CMD中打开您的终端并粘贴

flutter upgrade --force

答案 3 :(得分:0)

在我的情况下,Flutter进行了未分段的更改(因为它使用git),因此我需要隐藏或重置它才能升级它。转到flutter的路径,然后:

git add -A
git reset --hard

或者,您也可以使用--force对其进行升级。

flutter upgrade --force