After building my flutter application in VS code, I successfully run the app, everything works fine. But after 2 or more times of restart of the application, whenever I run my code again, the build gets failed. This is the error pops up.
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
When first time this error has occured, I cut all the files from the current directory and copied into other directory, and then it works again fine. But even now after running 2 or 3 times again the error pops up. Is there any fix available to this problem?
I tried deleting the .vscode, rebuilding again, but still its the same!!
This problem can be solved by turning of Windows Controlled Folder AccessSteps to turn of windows cont