gpt4 book ai didi

git - 尝试运行时出错 `flutter upgrade`

转载 作者:IT王子 更新时间:2023-10-29 07:12:38 27 4
gpt4 key购买 nike

我正在尝试升级我的 Flutter SDK 并将我的 Flutter channel 更改为 master,但我遇到了以下错误:

git: error: Your local changes to the following files would be overwritten by checkout:
git: examples/catalog/android/build.gradle
git: examples/catalog/android/gradle/wrapper/gradle-wrapper.properties
git: packages/flutter_tools/gradle/flutter.gradle
git: Please commit your changes or stash them before you switch branches.
git: Aborting
Switching channels failed with error code 1.

为什么会发生这种情况,如何解决?

最佳答案

从 Flutter 安装目录执行的这些命令应该让您回到工作状态

git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor

现在 flutter upgradeflutter channel ...,...应该可以再次正常工作了。

https://github.com/flutter/flutter/wiki/Workarounds-for-common-issues#flutter-installation-corrupted

关于git - 尝试运行时出错 `flutter upgrade`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54381620/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com