Whenever I try to clean my flutter project by using the command
flutter clean
I get an error saying
Failed to remove build. A program may still be using a file in the directory or the directory itself. To find and stop such a program, see:
https://superuser.com/questions/1333118/cant-delete-empty-folder-because-it-is-used
I can understand that there is some directory opened and it has to closes in order to clean. But I cannot understand which one is it. I tried restarting my computer to resolve this issue. But still when I run the command flutter clean I get the error.
To clear Flutter's Build cache Open your flutter project folder in Command Prompt or Terminal. Then type flutter clean command and press enter. After executing flutter clean command we would see that it will delete the dart-tools folder, android folder and iOS folder in our application with debug file.
In your terminal hit flutter clean command , after that hit flutter pub get . Your all apk's will be delete.
So there are two ways you can solve this problem. 1- Restart visual studio code (it will automatically close the terminals) 2- Stop the terminal in which flutter project is already running and then run flutter clean command. Show activity on this post.
If you moved your project folder to another place then just **delete** your "build" folder
and
flutter clean
and
flutter pub get
you will be fine:) Cheers.
Simply run your cmd as administrator then run the command. As simple as that.
Thank me later.. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With