Upgrading Flutter卡住不动解决方法

  • 发表于
  • flutter

Flutter upgrade更新无响应

运行命令看到flutter提示有更新:

➜xx (master) ✗ flutter run
 A new version of Flutter is available! 
 To update to the latest version, run "flutter upgrade".

执行更新报错:

$ flutter upgrade
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.

修改命令:

$ flutter upgrade --force
Downloading Dart SDK from Flutter engine b6b54fd60631a3828c2e2c9b079b5d1d2d8c8c37...
% Total% Received % XferdAverage Speed TimeTime TimeCurrent
 DloadUpload Total SpentLeftSpeed
100200M100200M0 01903k00:01:470:01:47 --:--:-- 2021k
Building flutter tool...
Upgrading Flutter from /Users/xx/flutter...

然后就这样,卡着不动了。

解决方法

  1. 进入flutter\bin目录下,双击flutter.bat文件,或运行flutter文件,下载windows/mac需要的系统依赖,从新回到终端,运行flutter upgrade
  2. 挂上代理尝试,因为涉及到下载所需的pub包和编译开发工具,有些地区会无法访问pub。时间有点久,快的几分钟,慢的可能会出现10分钟左右。