在 VS 代码中构建我的颤振应用程序后,我成功运行了该应用程序,一切正常。但是在应用程序重新启动 2 次或更多次之后,每当我再次运行我的代码时,构建都会失败。这是弹出的错误。
Target debug_android_application failed: FileSystemException: Cannot copy file to 'J:\flutter_projects\webdoc\build\app\intermediates\flutter\debug\flutter_assets\assets\images\background.png', path = 'J:\flutter_projects\webdoc\assets\images\background.png' (OS Error: Access is denied.
, errno = 5)
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 9s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 10.2s
Gradle task assembleDebug failed with exit code 1
第一次出现此错误时,我从当前目录中剪切所有文件并复制到其他目录,然后再次正常工作。但即使现在再次运行 2 或 3 次后,错误仍会弹出。是否有任何解决此问题的方法?
我尝试删除.vscode,再次重建,但还是一样!!