1

I've never had this error. The error doesn't appear when I run "flutter run -d chrome" for the initial flutter example but when I add a couple of folders this error appears. thank you for the help

Flutter failed to delete a directory at "build\flutter_assets". The flutter tool cannot access the file or directory.     
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
DAni M
  • 683
  • 1
  • 10
  • 21

1 Answers1

0

The build folder is auto-generated when flutter runs. If you created the flutter_assets folder in the build folder, move it to the assets folder instead. (I mixed up the assets and flutter_assets folders in my head.)


I had this issue and wound up manually deleting the entire build folder and running flutter clean (see other suggestions here on SO and here on GitHub).

TarHalda
  • 1,050
  • 1
  • 9
  • 27
  • It only works once. Next time I run it, I get the same error. – brikas Sep 27 '22 at 08:15
  • @brikas have you run `flutter clean`? – TarHalda Sep 27 '22 at 14:31
  • 1
    Thank you for the reply! Yes I did, at the very least. I been sitting on this a bit more and the cause of the problem has smth to do with synced Google Drive directory, as the error dissapears when ran in a different directory. But such workaround is bad for me, since Google Drive sync is essential for me on Flutter projects. If you could spare some time to insvestigate, I described whats happeneing here: https://stackoverflow.com/questions/73864416/flutter-run-and-clean-error-flutter-failed-to-delete-a-directory-when-project – brikas Sep 27 '22 at 17:04
  • Your solution is probably good for most cases, it just turns out that my case has extra complexity. – brikas Sep 27 '22 at 17:06