Flutter 增長三方庫卡在flutter package get 的解決辦法

修改 pubspec.yaml 文件增長第三方庫以後,AndroidStudio 像往常同樣提示 須要 package get。git

而後一直卡在github

Running "flutter packages get" in flutter_project_name...    

等啊等,等不了想從新執行package get,結果spa

Waiting for another flutter command to release the startup lock...

解決方法:get

打開flutter安裝文件夾,找到\bin\cache中的lockfile文件,刪除之,就能夠從新package get了。it

然額仍是一隻卡住。。。io

Flutter畢竟是Google的,查了下原來還有Using-Flutter-in-Chinaclass

大概意思就是 把 package 獲取地址改成訪問國內鏡像站就能夠了。變量

  • Linux 或 Macflutter

    export PUB_HOSTED_URL=https://pub.flutter-io.cn
    export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  • Windowsfile

    PUB_HOSTED_URL ===== https://pub.flutter-io.cn
    FLUTTER_STORAGE_BASE_URL ===== https://storage.flutter-io.cn

增長兩個環境變量,而後執行一下 flutter doctor命令。問題完美解決。

相關文章
相關標籤/搜索