The flutter tool cannot access the file or directory. Windows - flutter

I updated the android studio and created a new flutter project but "flutter clean" was not working.
Flutter failed to delete a directory at "G:\MY APPS\perfume\.dart_tool".
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.
However, the following directory works
C:\Users\Rohai\AndroidStudioProjects\untitled>
Even "run as administrator" doesn't work. How to make flutter tool work with a specific directory or folder in win10."G:\MY APPS\perfume\

Related

How to get flutter to open in terminal zsh on mac monteray

Flutter opened and moved to developer folder. I haven't had any luck updating the flutter path in the terniaml. It fails to open flutter
I enter the info posted on the flutter website and replace the path with my info on where the flutter folder is located on my computer. i run, source $HOME/.. Then a error code comes back. If i run,
echo $PATH
then it comes back flutter not detected.
According to the installing Flutter documentation, you should put the downloaded folder in the development folder, not the developer folder. Try moving the downloaded folder to the development folder.
If you are unable to update the path via the terminal. Just do it manually.
Steps to manually update the path:
Since you already know you have a zsh terminal. Go to /Users/[your username]. Unhide the files by hitting [cmd+shift+.].
If you don't have a .zshrc file. Just create a new file. You can download my .zshrc file from here: .zshrc file
open it in TextEdit and write this
export PATH="$PATH:/Users/syedsadiquh/Development/SDKs/flutter/bin"
After the $PATH: just replace it with your own flutter/bin location.
Now close all terminal windows to source the new file automatically.
Now verify your path by running echo $PATH
Now verify that flutter is available by running which flutter.
The official flutter docs to refer (see update your path section): Official flutter docs

Cannot Create Flutter Project in Android Studio due to missing pubspec.yaml

Whenever I create the Create new Flutter Project in android studio,
It's always throwing out this error: Please help.
Could not find a file named "pubspec.yaml" in "/Users/<usrname>/AndroidStudioProjects/inventory_system". pub get failed (66; Could not find a file named "pubspec.yaml" in "/Users/<usrname>/AndroidStudioProjects/inventory_system".)
First of all make sure your flutter is properly installed on your system. Faced the same issue. Try checking your installation and make sure everything is installed properly. Use this link: https://flutter.dev/docs/get-started/install
Just uninstall android as well as flutter. Try installing them again. First download and install Flutter. Then download and install Android Studio. Follow the proper installation process. I guess your issue is because of the unproper installation.
After flutter installation, open the folder where you have installed it, and open the file flutter_console which is a batch . It will open a console and then type:
flutter doctor
This will show you whether all the installation is properly carried out or not. But a better way is to perform proper installation.
Also you need to set environment variable after the installation.
Here is what happened with me when I installed flutter and android. This is just to show you the issue I had faced after installation
I then followed what was been said as error and got my flutter and android studio working.
Open the terminal.
Create the folder for your project by typing the command:
mkdir my_awesome_project
Navigate to the created folder:
cd my_awesome_project
In the folder type the command for project creation:
flutter create myawesomeproject
Open the AndroidStudio and then open the created folder.
Now you are ready to run and develop your app.
the easiest and simplest way to create new flutter project is to add flutter plugin to android studio/vs code and selecting SDK dir and then you can simply create new flutter project by clicking on buttons
and you can check flutter official guide

Can not install Flutter on MacOs, Tells that the unzip process is not working

When I try to install
unzip ~/Downloads/flutter_macos_2.2.2-stable.zip
this message pops up
unzip: cannot find or open /Users/user/Downloads/flutter_macos_2.2.2-stable.zip, /Users/user/Downloads/flutter_macos_2.2.2-stable.zip.zip or /Users/user/Downloads/flutter_macos_2.2.2-stable.zip.ZIP.
I don't what to do to install Flutter to OSX (vscode)
I can obtain flutter for Android Studio with no problems.
Also can't access flutter by itself on iTerm or Terminal.
First, it seems that your archive has two extensions .zip.zip, but it's probably not the problem you're facing.
You may want to check if your iTerm has the necessary permissions to access the content of the folder "Download" since it's a special folder for MacOS.
Second, for creating a flutter project through VSCode, you need to run the command flutter create myprojectnamehere, you will not have a button to create a flutter project like on Android Studio.
If you still facing issues with the installation of Flutter, you may want to checkout Flutter_Installer which is a Flutter GUI Installer made with Flutter.

Flutter doctor hangs on start, no output

I'm trying to install Flutter on my Windows 8 computer. I unzipped files to C:/flutter and added the bin folder to the path variable. However I am stuck on the step where I have to run flutter doctor in flutter_console. The Flutter doctor hangs and only shows the blinking cursor and no output. More interestingly any other flutter command will freeze the exact same way.
I have already tried
Running flutter console as admin
Reinstalling flutter
Installing the dev version
Use the VS code plugin to run flutter doctor
But they all led to the same result
So the solution of this issue is:
delete folder in your flutter SDK path flutter/bin/cache (detail info here)
run flutter doctor -v again will trigger downloading Dart SDK
PS: if your network is slow because of in china, check bellow:
Do things bellow in terminal maybe speed up your the download speed (for me it's speed up 3x) for changing channel:
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn (detail info here)
flutter channel stable (one example of change flutter channel)
flutter doctor -v (trigger downloading SDK)
Albeith in win10, these steps solved the issue for me (do not know if all are necessary)
restart win
run cmd as administrator
flutter doctor
According to this git issue, this is mostly caused by installing flutter in a directory for which you do not own the priviledges. For example, the Program Files folder: to solve then, you can try to move the installation folder
Problem
I had the same problem while trying to reinstall flutter using the recommended windows install guide found here https://docs.flutter.dev/get-started/install/windows
(flutter_windows_3.3.9-stable).
All flutter commands would hang and only show the flashing cursor. It did not matter if I was in the flutter console, PowerShell, VS Code terminal or Admin Command prompt.
This made running flutter doctor impossible, and thus I couldn't complete the flutter setup.
Environment
I am using a PC running Windows 10.
I am located in North America. (If you are in China, you may need to use a proxy server for the initial download).
Flutter was installed on a drive with ample free space in a non-restricted folder.
I have a stable internet connection.
I have git for windows installed and have set up my ssh keys. (you can download and install this form here https://git-scm.com/download/win).
I have my Windows Firewall and network protection on. (You may need to turn off third party firewalls or add a rule to them allowing flutter to make connections to the internet during the flutter setup).
Solution
This solution worked for me and should resolve most install problems related to installing flutter on a Windows environment.
Please upvote if it works for you.
Step 0 - Remove flutter from system:
If reinstalling flutter, do this step, otherwise move to step 1 if preforming a fresh installation.
Open file explorer and delete the folder titled flutter if already installed.
Type environment variables into the windows search bar and open Edit the system environment variables.
Click environment variables in the Advanced tab.
Double-click the word Path found under User variables for {YOUR USER NAME}.
Select any entries that end with \flutter or \flutter\bin and delete them.
Click the Ok button and then the Ok button to apply the changes.
Step 1 - Download Stable Flutter Version:
Go to the official flutter website https://docs.flutter.dev/development/tools/sdk/releases and download the most recent flutter version in the Stable channel (Windows).
Once downloaded, unzip the folder.
Place the flutter folder found inside the Zip file wherever you would like to store it on your computer. Flutter recommend putting it in C:\src\flutter. You can place it where've you like as long as It's not in a folder that requires elevated privileges to access, such as the C:\Program Files\ folder.
Note* I used Windows Explorer to unzip the file, however others report used 7-Zip file Manager for unzipping solved their problem.
Step 2 - Setup Environment Variables:
Type environment variables into the windows search bar and open Edit the system environment variables.
Click environment variables in the Advanced tab.
Double-click the word Path found under User variables for {YOUR USER_NAME}.
Click Browse... and navigate to where you placed the flutter folder. Then navigate to the bin file inside the flutter folder and click ok.
A new environment variable should have been added that looks like C:\src\flutter\bin.
You also need to make sure Git\bin\cmd, Git\bin\git.exe and, C:\Windows\System32\WindowsPowerShell\v1.0\ system environment paths are setup. These were post likely configured during your git for windows install.
Follow the "Update your path section" found here https://docs.flutter.dev/get-started/install/windows if this doesn't work for you.
Note* If Path doesn't exist, click new... and set variable name to Path and Variable value to the file path of your bin folder found in the flutter folder you just unzipped.
Step 3 - Reboot your computer in Safe Mode with Networking:
Press the Windows key + I on the keyboard to open Settings, or type settings in the windows search bar.
Click Update & Security and on the left pane select Recovery.
Under Advanced Startup, click Restart Now.
After the computer restarts, on the Choose an Option screen, select Troubleshoot > Advanced Options > Startup Settings > Restart.
After the computer restarts, a list of options appears. Select 5 or F5 for Safe Mode with Networking or whatever key your computer says to boot into Safe Mode with Networking.
Step 4 - Launch Administrator Command Prompt:
After rebooting, type command prompt into the windows search bar.
Right-click the application icon and click Run as administartor.
Run the following commands, flutter pub cache repair then flutter doctor -v. This might take quite some time if you have poor internet, as it will re-downloads every package in the cache.
If flutter doctor reports any red or yellow warnings with your environment, you need to resolve these first before continuing. These are quite common, and a Google search of the error or warning should solve your problem.
Note* if the command flutter is unrecognized, this means you didn't set up your environment path variables in step 2 correctly.
Step 5 - Reboot and run your project
Now that flutter doctor has run in safe mode, we can restart the computer and get out of safe mode.
Open your flutter project in Visual Studio Code.
Open a terminal window under terminal > new Terminal.
run the command, git config --global --add safe.directory C:/src/flutter make sure you use forward / and set the file path to wherever you saved your flutter folder. This can also be run from the administrator command prompt if you don't have VS Code or a flutter project.
Then run flutter doctor -v in the VS Code terminal to make sure everything is working.
Now we need to rebuild all of our packages and dependencies, run the following list of commands in order.
flutter clean
flutter pub cache repair
flutter pub get
flutter pub upgrade --major-versions
Troubleshooting
These are other solutions I noticed on stack overflow while trying to solve the problem for myself. These didn't work for my situation, but may help you solve yours.
Flutter doctor, running very slowly. Try deleting the cache folder found in, C:\src\flutter\bin\cache\ then running flutter doctor -v again. Flutter doctor hangs on start, no output
If you are in China. Download flutter through a mirror site.
Try installing a different type of unzip program (like 7-zip).
Make sure you are using the Stable flutter channel.
Make sure your path variables are set up correctly.
getting error "Waiting for another flutter command to release the startup lock" Use task manager to forcibly close any flutter or dart programs.
Can't delete old flutter folder, in use for some reason. Restart and immediately delete the folder.
Make sure flutter isn't installed in a folder that requires admin privileges to access, such as C:\Program Files\.
Make sure you have git for windows installed and have set up your ssh keys.
Add the Flutter and Dart extensions to VS Code.
Add the flutter and Dart plugins to Android Studio.
Delete the cache folder inside bin folder of the flutter sdk then run flutter doctor it should work now.

Setting up Flutter with Visual Studio Code

I am a C# developer, but have been tasked with developing a Flutter app, and I am discovering I have no idea what I am doing. I have a copy of Visual Studio Code and have installed the Flutter SDK, but they aren't working together. The Dart and Flutter extensions are installed, but when I CTRL+SHIFT P and select Flutter: New Project, the prompt disappears and I find myself with nothing changed on the screen. Earlier, I was getting an error that VSCode could not find my SDK.
I am going nuts. Can someone tell me where to start debugging this problem?
Seems that you don't have the SDK installed.
Navigate to the View option on vs code then select Command Palette.
type the word flutter in the palette; it should give you a list of commands, for
instance, creating a new project and flutter doctor.
Select either Flutter: Run flutter doctor of Flutter: run new project
You will get an option at the bottom|right side of vs code to select installation folder for SDK (if you don't have it). You will then be prompted with Project name and location.
To run your sample project, you can use flutter run command.
VS Studio is looking for flutter in predefined folders as indicated in the "View Logs" button. To fix this, Add the flutter\bin folder in your environment variable.
In Windows, right-click "This PC" -> "Properties" -> "Advanced System Settings" -> In "Advanced" Tab, click on "Environment Variables", In "System Variables" section select "Path"
Next click "Edit", click "New" and put the location of the bin folder where flutter is installed.
Restart VS Studio, and re-run flutter doctor.
If you're running Flutter: New Project and then seeing nothing at all, then this is certainly a bug in the extension. It's supposed to prompt you for a project name and location.
If you can still reproduce this, please raise a bug on GitHub and if possible attach an Extension log. There may also be useful information in the dev console (Help -> Toggle Developer Tools).
Flutter setup for VSCode windows
You Need to download flutter libraries either from flutter or git
a. From flutter
https://storage.googleapis.com/flutter_infra/releases/stable/windows/flutter_windows_v1.12.13+hotfix.9-stable.zip
b. From git clone (make sure git is installed in your system)
C:\src>git clone https://github.com/flutter/flutter.git -b stable
Extract or clone flutter libraries in following directory
C:\flutter
Add a new environment veritable path C:\flutter\bin
Run flutter version to check flutter installed correctly
Install VSCode
Install Flutter and Dark extensions in VSCode
Press Ctrl + Shift + P to open command palette. Type in the search bar Flutter and click on Flutter: New Project.
It will create a demo project.
Run flutter to run demo project
Note - You may need to install android studio as it will set android SDK and emulator