【Flutter】Warning! This package referenced a Flutter repository via the .packages file that is no ...

错误描述:

Warning! This package referenced a Flutter repository via the .packages file that is no longer available. The repository from which the 'flutter' tool is currently executing will be
used instead.
  running Flutter tool: /Users/sunyd/Desktop/DevelopTool/flutter
  previous reference  : /Users/sunyd/Desktop/DevelopTool/flutter-stable
This can happen if you deleted or moved your copy of the Flutter repository, or if it was on a volume that is no longer mounted or has been mounted at a different location. Please
check your system path to verify that you are running the expected version (run 'flutter --version' to see which flutter is on your path).

起因:
本地使用的flutter sdk版本是1.9.1。想体验下官方的最新版本,所有在现有的flutter 同级目录,下载了官方stable分支下的最新版本。
但是打开现有错误却报错了。

错误位置:
通过错误提示可以看出.packages文件出了问题。

打开.packages文件,发现工程中的员sdk路径都变成了新的。

解决方案一:
(我没有尝试,因为这样会重新下载所有插件依赖。对于我们的项目来说很多插件不好下载。)
删除.packages重新build。

解决方案二:
(解决我的问题)
打开.packages,将新的flutter sdk路径,全局替换成之前的路径。

你可能感兴趣的:(【Flutter】Warning! This package referenced a Flutter repository via the .packages file that is no ...)