2

I'm working on flutter to develop a "map-navigation app". I'm new to it. It showed "some of the dependencies are outdated" so I update the packages and pub files, after that the application is not running on any of the platform (i.e. Desktop, Web, android and ios). It shows the following given error.

Also tried manually deleting the build folder from the project and then executing the app, still facing the same error.

Manually deleting the build folder, applying flutter clean command then running the app still shows the error below:

image

Launching lib\main.dart on Chrome in debug mode...
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.
Waiting for connection from debug service on Chrome...

Flutter failed to delete a directory at "build\flutter_assets"

I want to execute this application on web or android. Want to provide flutter tool the access to file or directory.

1
  • try the following, move your project to c:\users\public\ and then open cmd into that folder, run flutter clean command and then open this project and try to run. see if it works or not. Commented Dec 19, 2022 at 7:30

9 Answers 9

3

The problem is probably because it is not a good idea to have a space in the path to a flutter project ie. 'HP PC' would be better named with an underscore instead of the space character.

The flutter documentation warns you of this here https://docs.flutter.dev/get-started/install/windows

Sign up to request clarification or add additional context in comments.

1 Comment

Ok good. You probably should upvote one or both of us that you think helped you. That encourages people to help you next time, and what you will want when you help someone. That's what drives SO.
1

For anyone who faces this issue in future, as mentioned by @GrahamD this issue is because of space in the path. In this case it's HP PC that should be HP_PC or HPPC or any valid string. Here are few ways you can troubleshoot this issue.

  • Rename the user account. Examples: mypc, my_pc, MyPc, myPC, etc.
  • Change the working directory to the path that doesn't contain space/s. Example: C:\Users\Public\ etc.
  • Create a new user with a name having no space/s.

After moving your directory, run flutter clean command and then run your project again. It should work now.

Note: You may need to install software if you create a new user account.

2 Comments

In my case, I don't have any space in between but I have upper case, so I move my project to another drive (D: drive) with the proper name (lower and underscore). Maybe it shows an error because of the C: drive as @thobani said, it restricts some activity.
Just to add to this, I had the same issue with the "-" character. It took me ages to realise that was causing it until I tried creating recreating the project from scratch with that name and it showed me an error related to it. I replaced the dashes with underscores "_" instead and now it works. No errors related to permissions or processes anymore!
1

One of the issues could be that the project is running from C: drive, if possible you can move the project to a different drive. C: drive usually has a lot of restrictions.

Comments

1

For me, the issue occurred because the project's Windows build file was running in the background. I had to end the task in Task Manager, and then it worked.

Comments

1

In my case, this error occurred because a file in the build directory was locked by another process (such as an IDE or file explorer).

I resolved the issue by manually deleting the build directory.

1 Comment

I just manually deleted the flutter_assets folder which is located inside the build folder and issue was solved.
0

Go to your project's folder/build/ and delete flutter_assets. That is it!

Comments

0

For me it is because my I had not updated the .gitIgnore to avoid build folder so my git tool had included it so didn't allow to delete

1 Comment

How to update gitignore?
0

Right click on the drive, select Properties. Go to security, And allow all in the permissions for everyone

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
-1

This was my error when try to debug the Flutter app on my Android smartphone>:

Unable to delete directory 'C:\Users\Jean-Pierre\Development\Flutter\audio_learn\build\app\outputs\apk\debug' 
Failed to delete some children. This might happen because a process 
has files open or has its working directory set in the target directory.

The problem could only be solved by restarting Windows 10.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.