Weird output from "flutter clean" command when used outside folder that has build - flutter

When i run flutter clean a folder outside the main build folder. I this response:
Changing current working directory to: /User/..
Why is that? and what does working directory refer to? How do i know my old one?

There needs to be a yaml file for flutter clean to work correctly.
That was my mistake.

Related

Can't find pub/cache folder in %LOCALAPPDATA%

I am trying to make pub an environment variable. The dart.dev says it must be in user/AppData/roaming folder named as pub I looked in roaming, local and locallow folders but there is not such a directory. The dart itself is installed with flutter sdk I looked in the folder too there is a folder named bup-cache but it does not have a pub.bat or pub.exe file as far as I saw.
Pub get itself works fine when i use it with flutter on VSC IDE but I can not locate the folder to make it environment variable.
Can you guys help me find The pub folder?
Thanks in advance
and be cool I'm a newbie
You have to go inside of this folder on Windows:
C:\Users\YOUR_USER_NAME\AppData\Local\Pub\Cache
Maybe you cleared the cache and that's why you cant find it
well i got it sorted out in a way the folder was not there and i needed it to use stagehand.
I simply ran a code in CMD or whatever shell which let to solution it was:
dart pub global activate stagehand

Unverified breakpoint in VSCode in Flutter

My debug mode does not work as I see the unverified breakpoint notice in VSCode in debug mode.
I already checked the Launch json file and it is fine, but something else is wrong which I do not see what it is. Maybe something related to paths, etc.
I tried to make a new project in VSCode using the command and the new default Flutter project is OK.
So it seems like, if I can make a fresh project from my current project then my problem could be solved. But how? I tried to move my files from my current project to the newly made Default Flutter project but I do not think this is the way. Because I guess some of the files in my project are the source of issues...
I already deleted .vs file but no help.
Do you have any good idea how to fix this issue?
First try cleaning the project files using flutter clean then flutter pub get, try running the app without debugging and if you are down for making a new one just move the lib and assets folders and copy the content of pubspec.yaml file.

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

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).

Could not create task ... this and base files have different roots

I've built an app with Android Studio and Flutter and wanted to generate a signed APK.
When I go to Tools->Flutter->Open Android module in Android Studio, it starts to build the project.
But after some time I get this Error and I don't know how to change the roots or what to do.
It seems like the problem are just two packages (url_launcher and shared preferences)
My Project is on my hard disk F:
and the flutter folder is on my hard disk C:
Error Message "Could not create task..."
Is this maybe because my project is on F: and the flutter folder with the packages in C: ?
How can I change the flutter folder to F: ?
I fixed mine by moving the project directory to the same drive. My project was stored in E:\ so, I moved it to C:.
My answer is almost the same as rvr93's answer but I did not add anything to the environment variables.
Create a directory in the same drive as your project and add PUB_CACHE environment variable. Run flutter pub get.
This worked for me.
I had your same issue, Gradle couldn't sync the android module, I solved it by deleting the android/ directory from the Flutter project, then recreate it using the command flutter create --platforms android .
Notice the "." at the end of the command it's part of it, it means create the Android project in the current directory.
As a workaround, you can do the following steps -
run flutter clean
do the Gradle sync without flutter pub get and make necessary changes to
native android code.
do pub get and run the app.
I have the same issue,
it seems the flutter project and the SDKs are in different prtitions of the hard disk
just go to the project root and run flutter clean
then go to the android folder and delete the .gradle folder
then back to the project root and run flutter pub get
and rebuild the app
As a workaround, you can do the following steps :
Open a terminal.
Run flutter clean.
Do the Gradle sync without flutter pub get and make necessary changes to native Android code or click on try again.
Do flutter pub get and run the app.
You will see that the SHA1 has been generated.
I faced the same issue in my android project after upgrading gradle.
My project was in my D drive, and I had set the destination folder for the generated apk in my desktop, which is in C drive. I changed the destination folder to a folder in D drive, and the issue got resolved.
I was facing the same issue all I did was to go build.gradle file in android folder and then change the following code as follows
dependencies {
//CHANGE THE Version in YOUR BUILD.GRADLE FILE
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
This is a temporary solution - track status here

'flutter doctor' returns '\flutter\bin\cache was unexpected at this time.'

I have downloaded flutter_windows_1.17.1-stable and extracted it outside the program files, yet whenever I run the 'flutter doctor' command I am getting the message '\flutter\bin\cache was unexpected at this time.'
I have searched about this and found few solutions suggesting to delete the cache folder in bin of flutter directory, I did that, also added the path in environment variables, still having the same message.
Please, I need suggestion on how to fix this.
Thank you.
Faced similar issue, I initially created C:\Program Files(Manual)\Flutter
and added to user env path variable, but got Cache error, only when I moved to c:\src\Flutter it worked, I'd say paths with spaces (and or special chars '(' ')' ' ' aren't accepted
While you're using windows, go to the system environment variables from the search and edit flutter path variable, change it to the binary folder like C:\src\flutter\bin.
When I ran into this issue, I had already installed flutter several times to fix previous errors. This issue can happen if flutter is not installed in your environment variables, but it also happens if there is another duplicate or path to another bin in the same host. Also, make sure to check on all places for duplicate paths to two or more flutter bins. There are environment variables for your account, and environment variables for the entire PC. Be sure to check in both
Make sure you extract all your files to c:/src/flutter
If the problem is still there , then to run commands use c:/src/flutter/bin
I.e., include bin to your path
I had the same issue. I tried all the above solutions, but they did not work. So I also changed the path. The solution was to direct the CMD to Flutter's main directory.
Example: You want to run the code flutter doctor. You expect to open the CMD and run the code, so you get the result while you have configured the env and path, but it does not. To run the code, go to the same directory you installed the flutter and then run your codes;
E:\Program Files\flutter> flutter doctor
I hope it works for you as it worked for me. GL
1.) Move the Flutter folder to your C Drive.
2.) Create a new Folder called "src".
3.) Move Flutter folder to src.
4.) Add C:\src\flutter\bin to Path in Control Panel -> User Accounts -> Enviorments -> Path -> edit
first if you changed your flutter's location and if you gave path again to variables, you you need to dalate old path of flutter and it works.