升级Flutter SDK和软件包
My-Mac:~ admin$ flutter upgrade
Upgrading Flutter from /Users/admin/Desktop/SDK/flutter...
error: Your local changes to the following files would be overwritten by merge:
packages/flutter/lib/src/services/message_codecs.dart
Please commit your changes or stash them before you merge.
Aborting
Updating 2eeeXXXe9..7XXXbf4aX
我使用了Flutter SDK,并检查了status
并了解了以下内容
My-Mac:flutter admin$ git status
On branch master
Your branch is behind 'origin/master' by 565 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: dev/automated_tests/pubspec.yaml
modified: dev/benchmarks/complex_layout/pubspec.yaml
modified: dev/benchmarks/macrobenchmarks/pubspec.yaml
modified: dev/benchmarks/microbenchmarks/pubspec.yaml
modified: dev/bots/pubspec.yaml
modified: dev/devicelab/pubspec.yaml
modified: dev/integration_tests/android_semantics_testing/pubspec.yaml
modified: dev/integration_tests/android_views/pubspec.yaml
modified: dev/integration_tests/channels/pubspec.yaml
modified: dev/integration_tests/external_ui/pubspec.yaml
modified: dev/integration_tests/flavors/pubspec.yaml
modified: dev/integration_tests/platform_interaction/pubspec.yaml
modified: dev/integration_tests/ui/pubspec.yaml
modified: dev/manual_tests/pubspec.yaml
modified: dev/snippets/pubspec.yaml
modified: dev/tools/pubspec.yaml
modified: dev/tools/vitool/pubspec.yaml
modified: examples/catalog/pubspec.yaml
modified: examples/flutter_gallery/pubspec.yaml
modified: examples/hello_world/pubspec.yaml
modified: examples/layers/pubspec.yaml
modified: examples/platform_channel/pubspec.yaml
modified: examples/platform_channel_swift/pubspec.yaml
modified: examples/stocks/pubspec.yaml
modified: packages/flutter/lib/src/services/message_codecs.dart
modified: packages/flutter/pubspec.yaml
modified: packages/flutter_driver/pubspec.yaml
modified: packages/flutter_goldens/pubspec.yaml
modified: packages/flutter_localizations/pubspec.yaml
modified: packages/flutter_test/pubspec.yaml
modified: packages/flutter_tools/pubspec.yaml
modified: packages/fuchsia_remote_debug_protocol/pubspec.yaml
Untracked files:
(use "git add <file>..." to include in what will be committed)
OLDSDK.zip
no changes added to commit (use "git add" and/or "git commit -a")
完成上述任务后,现在尝试再次升级Flutter,但再次遇到下面提到的错误
My-Mac:flutter admin$ flutter upgrade
Building flutter tool...
Because flutter_tools depends on sockjs_client 0.3.5 which doesn't match any versions, version solving failed.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
.
.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (1 tries left)
Command 'pub upgrade' still failed after 10 tries, giving up.
答案 0 :(得分:1)
Flutter使用git进行SDK管理。 您需要查看$ HOME / development / flutter中的存储库。 您可以使用git命令检查您的重新发布状态。 例如,
$ git状态
查看您的本地更改
$ git分支
查看正在使用的分支。
以下步骤可能会为您提供帮助,当您发现自己所做的更改尚未提交时,可能会有所帮助。
$ git reset --hard HEAD
撤消所有更改。
$ git checkout master
切换到主分支
$ git pull
下拉并同步服务器上的所有提交。
答案 1 :(得分:0)
您可能不小心编辑了颤振代码。
要解决此问题,请转到您的flutter文件夹,该文件夹应为/ Users / admin / Desktop / SDK / flutter
并通过运行检查所有更改
git status
如果有任何更改,就您而言,您已更改了package / flutter / lib / src / services / message_codecs.dart,只需通过以下方式将其还原:
git checkout -- packages/flutter/lib/src/services/message_codecs.dart