在尝试删除Flutter_assets构建目录中的过期资产时,出现PathAccessException错误,

icomxhvb  于 5个月前  发布在  Flutter
关注(0)|答案(2)|浏览(74)

在稳定版本3.22上。
命令:flutter assemble

PathAccessException: PathAccessException: Cannot delete file, path = 'C:\<redacted>\build\app\intermediates\flutter\debug\flutter_assets\assets/<redacted>.png' (OS Error: Access is denied.
, errno = 5)
at _File.throwIfError(file_impl.dart:675)
at _File._deleteSync(file_impl.dart:329)
at FileSystemEntity.deleteSync(file_system_entity.dart:407)
at ForwardingFileSystemEntity.deleteSync(forwarding_file_system_entity.dart:70)
at ForwardingFileSystemEntity.deleteSync(forwarding_file_system_entity.dart:70)
at ErrorHandlingFileSystem.deleteIfExists(error_handling_io.dart:80)
at FlutterBuildSystem.trackSharedBuildDirectory(build_system.dart:778)
at FlutterBuildSystem.build(build_system.dart:666)
at <asynchronous gap>(async)
at AssembleCommand.runCommand(assemble.dart:322)
at <asynchronous gap>(async)
at FlutterCommand.run.<anonymous closure>(flutter_command.dart:1394)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:153)
at <asynchronous gap>(async)
at CommandRunner.runCommand(command_runner.dart:212)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand.<anonymous closure>(flutter_command_runner.dart:372)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:153)
at <asynchronous gap>(async)
at FlutterCommandRunner.runCommand(flutter_command_runner.dart:308)
at <asynchronous gap>(async)
at run.<anonymous closure>.<anonymous closure>(runner.dart:130)
at <asynchronous gap>(async)
at AppContext.run.<anonymous closure>(context.dart:153)
at <asynchronous gap>(async)
at main(executable.dart:93)
at <asynchronous gap>(async)
f2uvfpb9

f2uvfpb91#

稳定的代码行:
flutter/packages/flutter_tools/lib/src/build_system/build_system.dart
第778行 in d3b60d4
| | ErrorHandlingFileSystem.deleteIfExists(lastOutputFile); |

vc9ivgsu

vc9ivgsu2#

我很惊讶这种情况会发生,因为在工具代码中的任何File示例都应该是一个可以捕获任何权限问题的ErrorHandlingFile。我想知道我们是否有办法找出为什么这不是情况?我们可以在某个地方实现某种诊断吗?

相关问题