使用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
解决方法
有以下两种方法
- 进入Flutter SDK文件夹,找到.pub-cache\hosted\pub.dartlang.org文件夹,如果存在
path_provider_macos文件夹,删除即可。如果没有,找到.pub-cache\hosted\pub.flutter-io.cn文件夹,删除path_provider_macos。
- 删除Flutter SDK,重新下载最新的SDK。再次运行。