Flutter解決path_provider編譯錯誤

使用path_provider時,運行時可能遇到以下錯誤

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':path_provider:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':path_provider:debugCompileClasspath'.
   > Could not resolve project :path_provider_macos.
     Required by:
         project :path_provider
      > Unable to find a matching configuration of project :path_provider_macos:
          - None of the consumable configurations have attributes.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Finished with error: Gradle task assembleDebug_QATDebug failed with exit code 1

解決方法

有以下兩種方法

  1. 進入Flutter SDK文件夾,找到.pub-cache\hosted\pub.dartlang.org文件夾,如果存在 path_provider_macos文件夾,刪除即可。如果沒有,找到.pub-cache\hosted\pub.flutter-io.cn文件夾,刪除path_provider_macos。
  2. 刪除Flutter SDK,重新下載最新的SDK。再次運行。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章