Full error:
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.
Error occurs when trying to run flutter run -d chrome with these notes (all on new freshly created projects):
If the project is located in C: drive - it works always
If the project is located in D: drive inside a synced D:\Google Drive\ folder, then it throws the error on 2nd run.
If the project is located in D: outside of the synced folder - it works always
However, I need it to run inside the synced folder, since I am using multiple locations and computer for development of a project.
Flutter 3.3.2 • channel stable. Only using for Chrome device (web dev). I am using Windows 10. Flutter installed on D:\src\flutter.
List of things I have tried:
Moving build folder contents to the assets folder instead. Result: runs once, but any additional runs throw the error again. As suggested here.
flutter clean Result: throws same error
Running flutter clean with cmd as an administrator. Result: same error
Deleting the folder manually. Result: complains about another folder with the same error. Once I manually delete all of the ones it complains about, it runs once, but any additional runs throw the error again.
Restarting computer
Even tried giving Everyone full-access permissions to the project folder.
Tried installing flutter in different location C:\src\flutter
I been trying to solve this for days and none of the answers I found on the internet work.
Flutter doctor output: https://pastebin.com/9XpHW7T8
EDIT: Tried a few more things and added them to the list.
EDIT2: Added another thing I tried.
EDIT3: Added flutter doctor output.
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.
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).
In javascript, we have NPM and the node_modules folder in every project. I was not able to find a similar concept for Dart/ Flutter, except the build folder in my app, which contains a folder of a few dependencies I have in pubspec.yaml. It doesn't have any of the source code though, and I think it's actually built from something else. I've also looked in /usr/local/flutter/packages which is where my flutter is installed, but it only shows flutter_driver, flutter_goldens, and more seemingly unrelated folders.
I guess if wanted to read the source code, I really need to find the repo and read from that, or is there a location for dependencies I haven't looked?
I even found projectDir/.dart_tool/pub, which didn't have any of my packages.
From the documentation:
Dependencies downloaded over the internet, such as those from Git and
the pub.dev site, are stored in a system-wide cache. This means that
if multiple packages use the same version of the same dependency, it
only needs to be downloaded and stored locally once.
By default, the system package cache is located in the .pub-cache
subdirectory of your home directory (on Mac and Linux), or in
%APPDATA%\Pub\Cache (on Windows; the location might vary depending on
the Windows version). You can configure the location of the cache by
setting the PUB_CACHE environment variable before running pub.
So for Mac and Linux for example, this would be ~/.pub-cache/hosted/pub.dartlang.org by default.
In Android Studio
I could directly view the source code of the package under `
[External Libraries/Dart Packages/Your Packages]
`
You can get pubspec downloaded from your flutter sdk location .
/flutter/.pub-cache/hosted/pub.dartlang.org/
You can also clone package git .
If you are running Windows as your OS, you can find the packages under the folder that you installed your Flutter SDK to when setting up Android Studio.
In my case - using Windows 10 - the path is as follows, where C:\ is my primary harddrive and flutter\ the folder containing the Flutter SDK...
C:\flutter\.pub-cache\hosted\pub.dartlang.org\english_words-4.0.0
The above path for instance points to the "english words package", containing the most ~5000 used English words and some utility functions, which are mentioned and used in the Flutter tutorial on their official page for writing and running your first Flutter app.
https://pub.dev/packages/english_words
If you have installed flutter using snap then the location might be
/home/user/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org
I had forgotten that I've been command + clicking into these libraries all the time in VSCode.
However, it looks like packages are not stored in the app folder. Packages that we use in our projects are downloaded to $FLUTTER_PATH/.pub-cache, so if I'm looking for camera picker plugin, its in
/usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.5+2/lib/image_picker.dart
If you are using VScode you can find these dependencies under the dependencies window:
I need some help in solving this problem in flutter installation
i Installed flutter put when running flutter doctor show an error
./flutter/bin/flutter: line 46: /c/src/flutter/flutter/bin/cache/dart-sdk/bin/pub: No such file or directory
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
Go inside flutter SDK
you have to delete the cache folder inside bin and it will help you.
Thanks!
I dont know whether u downloaded git or not, cloned it or not
so I recommend u to follow step by step as directed on this site-
https://flutter.dev/docs/get-started/install/windows
and the question u asked can be solved if u copy the location of flutter.bin which is located in flutter directory after cloning git, and set path of that particular files in environment variables.
you can find environment variables on right clicking on this pc icon >properties>advanced system setting>environment variables>click on path if dont have create a new path,if having select it >edit >and paste location there.
run flutter doctor.
that's it.
in my case, when I cancel the flutter upgrade in the middle of using an Android Studio then the flutter becomes unreadable again, then when I when the flutter in the terminal will be like this:
... flutter/bin/cache/dart-sdk/bin/dart: No such file or directory
then the solution is quite easy.
go to where the directory folder is / flutter / bin / cache /
Delete the dart-sdk folder
rename the dart-sdk.old folder to dart-sdk only
finished, your flutter is working again.
This type of steps follws for flutter setup :
1)download latest version of v1.7.8+hotfix.4 this below link
https://flutter.dev/docs/development/tools/sdk/releases
2)my flutter store in this url : C:\src
3)set enviroment variable C:\src\flutter\bin
4)Android studio download and install.
5)install plugin flutter & dart...in android studio...than after restart IDE.
6) than after i have to start a new flutter project
-flutter_demo (project name)
-C:\src\flutter (SDK path)
-C:\src\flutter_project (project location)
my issue is this when i have to create new flutter project only create blank folder in this location [[C:\src\flutter_project]] no any other process.
what is my issue??? i need to help???
this step follow another PC in window 7
--work properly
-but in my pc not working.
-my pc os is also window 7
I also faced with the same problem about creating flutter blank project. In my case, I check the installation steps and all are correct.
The answer is in User Environment Variable Path, there is also old flutter/bin path that I had tested before.
I deleted the old flutter bin path and also in System Environment Variable Path. Then, I can create flutter project and run futter doctor successfully.