【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。想體驗(yàn)下官方的最新版本,所有在現(xiàn)有的flutter 同級目錄,下載了官方stable分支下的最新版本。
但是打開現(xiàn)有錯誤卻報(bào)錯了。

錯誤位置:
通過錯誤提示可以看出.packages文件出了問題。

打開.packages文件,發(fā)現(xiàn)工程中的員sdk路徑都變成了新的。

解決方案一:
(我沒有嘗試,因?yàn)檫@樣會重新下載所有插件依賴。對于我們的項(xiàng)目來說很多插件不好下載。)
刪除.packages重新build。

解決方案二:
(解決我的問題)
打開.packages,將新的flutter sdk路徑,全局替換成之前的路徑。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容