How can install Flutter Correctly in Windows - flutter

I use this line in C:\src
git clone -b stable https://github.com/flutter/flutter.git
And in PATH i type this line:
C:\src\flutter\bin
Then
flutter doctor
but output is :
How can i install Flutter correctly?
some error is:
Error: 'pub upgrade' still failing after 10 tries, giving up.
Error: Error when reading '.packages': The system cannot find the file specified.
Error: Error when reading '../../bin/cache/flutter_tools.snapshot': The system cannot find the file specified.

I had the same problem days ago, what I did is
Remove cache folder inside bin/cache
Run flutter doctor again
Also I just cloned the master branch and then run flutter doctor
git clone -b master https://github.com/flutter/flutter.git
And if it doesn't work, most likely is what #user11945700 is saying, something about Antivirus or Firewall, so I recommend you to disable everything, install it, and then activate again.
Otherwise if you want other version you may use this to dowload Flutter releases versions
Another guess, could you install it if you run the prompt shell as administrator?

I use this link
https://flutter.dev/docs/development/tools/sdk/releases?tab=windows
extract file in C:/src
in
C:/src/flutter/bin
Run:
flutter doctor
This link help you to install Flutter:
https://www.aparat.com/v/Da9IN/%D8%A2%D9%85%D9%88%D8%B2%D8%B4_%DA%A9%D8%A7%D9%85%D9%84_%D9%86%D8%B5%D8%A8_flutter

If in your system antivirus or firewall is there then mostly its due to that. try after suspending antivirus and firewall
You also have one option directly download stable version from here - https://flutter.dev/docs/development/tools/sdk/releases

Related

Flutter simply showing 'sysctl -n hw.optional.arm64' returned unexpected output: ''

Not sure which details are relevant so I'll include as many as possible.
Had to upgrade flutter today and instead of working when I typed in 'flutter upgrade' into android studios terminal/Iterm2/terminal zsh I was met with the following response.
'sysctl -n hw.optional.arm64' returned unexpected output: ''
When I search for this issue the only thing i can find is this post which states that sysctl can't be found. The path does appear to be in my .zshrc but still not working. I can't use which or where sysctl as it just says 'sysctl not found'
When I try to upgrade flutter through brew (brew install --cask flutter) it downloads fine but on installing it throws the following error:
==> Purging files for version 3.3.5 of Cask flutter
Error: It seems there is already a Binary at '/opt/homebrew/bin/dart'.
I can't continue working as I need the new flutter version and it seems the web doesn't have much to show for this particular error.
I can't flutter --version, flutter doctor or anything of the sort as I just get the same message.
I'm using:
MacOS monterey 12.6 macbook air.
Android studios
Iterm2
Ohmyzsh
When I open android studios it shows me the following:
"Flutter device daemon #1 exited (exit code 1), stderr: 'sysctl -n hw.optional.arm64' returned unexpected output: '' in a pop up window.
Pubspec has been edited > get dependencies > Upgrade depenedencies: Both of which have the same error as in the title.
The current configured flutter SDK is not known to be fully supported. Please update your SDK and restart intelliJ which I think is what I've been trying to do.
This is an answer I hope will be helpful for others who have the same issue.
Other answers suggested a fix by just updating the path document (.zshrc) but this is what helped me as that did not and my paths were up to date.
Sadly, it's as simple as manually deleting all my flutter SDK files locally. Downloading them again (this time the latest one) and unzipping it into the same place. Didn't even have to update the path).
Worked a charm, issues appear to be all gone except that the dialogue in android studios is still saying that there are dependencies that need getting and upgrading (but doesn't go away even when I've run it).
I solved it by removing the old flutter SDK, downloading the latest version, and setting it up again.
it works perfectly for me!

Flutter - Error: Unable to create dart snapshot for flutter tool

When I run flutter change channel or flutter doctor, the CMD show me this:
C:\Users\MyUser>flutter doctor -v
Checking Dart SDK version...
Building flutter tool...
Running pub upgrade...
/C:/src/flutter/packages/flutter_tools/lib/src/aot.dart:144:5: Warning: Must explicitly return a value from a non-void function.
return;
^
When I run:
git clean -xfd
git pull
flutter doctor
The CDM show me this:
fatal: not a git repository (or any of the parent directories): .git
How can I solve it? Thank you
Had the same issue...Copied the flutter_tools from flutter download and replaced with the same folder in my installation then ran flutter doctor from command in administrator mode.
Funny the issue started 3 days ago for me too.
1.Go the Flutter install directory and please run (in cmd)
git clean -xfd
git stash save --keep-index
git stash drop
git pull
2.and restart your computer
then run
flutter doctor
3.then go to your project path run
flutter packages get
flutter run
I had the exact same problem yesterday, i tired to run
git clean -xfd
git pull
flutter doctor
in cmd and i kept getting:
fatal: not a git repository (or any of the parent directories): .git
eventually i gave up and i deleted the old flutter sdk directory from my PC as well as the path from Enviroment Variables and i downloded the new sdk and setup flutter again and now it's running fine
https://docs.flutter.dev/get-started/install
On windows, delete flutter folder C:\Users\User\AppData\Local\Pub
This is the flutter temp/cache folder and may contain outdated versions of the libraries
unfortunately none of the given solution so far works for me..
I had to the following steps, which was the only solution for me:
delete the whole flutter folder
extract (or copy) it from the zip-file to your installation directory (in my case I just downloaded the latest flutter version, because I didn't have access to the previous downloaded zip-file anymore)
open the IDE in the installation directory (or open the associated project)
run flutter pub get

Command doesn't work after upgrade flutter

Due to min v1.5 sdk plugin needs, I use flutter upgrade, but since I can't use command ... I have bash command not found,
I tried manually download 1.5 sdk and replace previous folder, when I use flutter doctor He say I have 1.2.1 ... I tried to re-upgrade but I have this error :
Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is
recommended that you stash them via "git stash" or else commit the changes to a local branch. If it is okay to remove
local changes, then re-run this command with --force.
C:\Users\utilisateur>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [version 10.0.17134.829], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[!] VS Code, 64-bit edition (version 1.21.1)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
! Doctor found issues in 1 category.
I tried git clean -xfd
i have ...
C:\Users\utilisateur>git clean -xfd
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again?
(y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? (y/ngit stash save --keep-index
) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try againgit stash save --keep-index
? (y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? git stash save --keep-index
(y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? (y/n)
In my case Flutter had unstaged changes (since it uses git), so I needed to stash or reset it to be able to upgrade it.
Go to flutter's path and:
# cd flutter_path/
git add -A
git reset --hard
Alternatively, you can use --force to upgrade it anyway.
flutter upgrade --force
Open your Terminal in Android Studio or CMD and Paste it
flutter upgrade --force
To make things simple can you extract the flutter sdk into folder 'c:\Flutter' Then set the path
Windows | iOS
Delete the old Flutter SDK folder you created. Then follow the steps illustrated here to point Android Studio to the new Flutter SDK installation.
I encountered the same problem. This probably occurred because I have my flutter SDK installed in the E:\ directory rather than default C:\ directory.
This is how I solved it,
1: Check where your Flutter Sdk is present. You can do this by creating a "New project->Flutter->Flutter Sdk" (This works if you have the flutter Sdk installed and configured, If you don't have it installed you can click on install Sdk option in the same "new Project->Flutter" window).
2: Then open Terminal by going to bottom right corner of you IDE and then clicking on terminal.
3: Change your directory to the flutter sdk's bin location by Typing "cd _yourSdkLocation\bin". Here replace "_yourSdkLocation" with the directory address where your flutter Sdk is present.
4: Then run "flutter upgrade --force"
In Terminal, use command
source .bash_profile
and then run ,
flutter upgrade --force
To remove changes in flutter directory, It will upgrade to recent flutter version
Press Windows+R to open the Run window.
Type cmd into the box.
Press Ctrl+Shift+Enter.
C:\>choco upgrade dart-sdk
Note: Make sure you open cmd with Admin permission

Why flutter doctor doesn't verify everything up correctly?

I follow the flutter documentation correctly. I'm done installing flutter SDK, put it at the correct path(c:\src\flutter[my flutter]), open the flutter_console.bat, locate at the command line cd c:/src/flutter, run flutter doctor, to see if there is anythin I need to do, I found one
And I get this error
Error: The Flutter directory is not a clone of the GitHub project.
The flutter tool requires Git in order to operate properly;
to set up Flutter, run the following command:
git clone -b stable https://github.com/flutter/flutter.git
And run the following command cd c:/src/flutter> git clone -b stable https://github.com/flutter/flutter.git base on what the flutter doctor says
After, I run flutter doctor again, and GET THE SAME ERROR.
Am I wrong?
I have the command prompt and powershell 5.1, my system requirements fits the criteria on running flutter apps.
I expect I don't have any issue running flutter doctor again
It seems you got the wrong path of the SDK.
Maybe this is a bug with flutter doctor.
Check yout flutter SDK version first,the latest version have fixed the issue.

Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds

Log:
E:\Flutter>flutter doctor Checking Dart SDK version... Downloading
Dart SDK from Flutter engine ead227f a... Unzipping Dart SDK...
Updating flutter tool... Error: Unable to 'pub upgrade' flutter tool.
Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
First Make sure you have a working internet connection and if this issue still exists then, this error may be because the dart sdk may have not been properly downloaded.
The simplest solution is to delete the cache folder located in
flutter/bin(location where flutter is installed) and then Run flutter doctor
I fix that by:
Ctrl+C to stop infinite error loop.
Kill the Dart process in Windows Task Manager.
Delete the cache folder located in flutter/bin directory.
Run in command line flutter pub cache repair.
After that I run flutter doctor and get predictable results:
e:\tools>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version
6.1.7601], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.44.2)
[√] Connected device (1 available)
! Doctor found issues in 2 categories.
I found my antivirus blocks pub upgrade,I had same issue while hitting flutter doctor, I turned off my antivirus and tried to run "flutter doctor" again, and worked well!
windows:
simplest and easiest way is download the latest version flutter sdk. replace manually current folder by pasting downloaded flutter folder instead of the current folder
in c drive. always choose replace and paste.
after finishing that check with flutter doctor. my issue solved
Solved this issue when Run the CMD as administrative.
This issue will come in protected network as well as due to anti-virus. Even I was facing the same. I downloaded latest stable version manually from the following link, which doesn't required any update process and it works for now..
Download Link For Flutter in Zip format
I updated the flutter SDK via git pull, then the flutter doctor command works.
Just delete the cache folder in flutter/bin and run flutter doctor again!!
Just Deactivate your antivirus and run it again. It would work fine. I had the same issue before.
I deactivated my antivirus for some time and executed flutter doctor command once again in cmd and got fruitful results after hours of patience.
One more thing to note, you should ensure that path of dart-sdk folder should be added to the path in user variables.
It seems it is not being able to "unzip" the downloaded Dart file because it misses 7-zip uncompressor.
I installed it and it worked! It will deal with .7z files.
I hope it works for other people too!!
I had the same problem and it was solved.
Steps:
Download Dart and Filters SDK then Decompress these files and move them to this directory.
C: \
Define the variables in path:
Delete cache directory in flutter/bin
Then run flutter doctor
Make sure you downloaded the windows powershell i use windows 8 it wasn't installed by default , when i downloaded it it worked for me.
Check your flutter bin path in environment variable(User Variables). If not go to Under User variables check if there is an entry called Path:in that add this flutter/bin path.
Strangly when I kill the dart process in Windows Task Manager it is working. But sometimes even when dart process is running update working.
I had to turn off the Android Emulator. It was running for me...
I got the same error and was not able to get rid of it. So I deleted the flutter and instead of cloning it I downloaded the zip from the flutter website and extracted it. Now it works just fine.
Manually downloading the SDK from flutter website fixed the issue.
Still dont know why this problem occured tho.
If you are using Avast (or possibly some other anti virus too) on Mac and have recently updated the OS to Big Sur then follow the below steps to fix this issue
Open Avast and in the Web Shield area disable the "Scan secure connection".
Run flutter config --no-analytics and then run pub upgrade.
This should probably fix the issue.
You can also refer to below threads in Github for more details about the cause
https://github.com/flutter/flutter/issues/40515
https://github.com/flutter/flutter/issues/68999
In my case, the error resolve after adding below folder into exclude option in anti virus
Flutter SDK location
D:\Android\flutter_windows\flutter\*.
Flutter Local Pub folder
C:\Users\hitesh\AppData\Local\Pub
You get the error --
"Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (1 tries left)" even if you are in one of the flutter directories from Windows explorer. Close the window and try running Flutter doctor. This will resolve.
If anyone faces this problem on macOS with AdGuard installed. Try this:
Go AdGuard Preferences -> Network -> Automatically filter applications -> Select Mode... and change mode to Automatic Proxy.
Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
Tried switch to Dev channel and got stuck with "Unable to pub upgrade". Did everything and nothing worked.
This is what I did:
Renamed the Flutter SDK folder
Download the latest Flutter SDK
Extract to the same location of previous renamed SDK
Flutter channel Dev
Flutter upgrade
And everything back to normal.
Source of Problem
It might be possible that you don't have enough free disk space. That's what caused my problems to begin with.
Solution
In my case,
First I had to clean up space to remove any unused files.
Then I had to overwrite the flutter SDK folder due to corruption. The SDK can be found here.
I had the same issue with my MacBook M1. I tried deleting and running flutter pub cache repair But It didn't work for me.
Then I ran the command softwareupdate --install-rosetta and accepted the software licences & agreement (After installing XCode). Now the command flutter works fine. :)
Tried all of the above without success. The search order in the PATH system variable turned out to be the problem:
it was:
G:\My Drive\Compilers\flutter\bin;
G:\My Drive\Compilers\flutter\bin\flutter;
G:\My Drive\Compilers\flutter\bin\flutter.bat;
G:\My Drive\Compilers\flutter\bin\dart.exe;
G:\My Drive\Compilers\flutter\bin\dart;
G:\My Drive\Compilers\flutter\bin\dart.bat;
changed it to:
G:\My Drive\Compilers\flutter\bin\flutter
G:\My Drive\Compilers\flutter\bin\flutter.bat
G:\My Drive\Compilers\flutter\bin\dart
G:\My Drive\Compilers\flutter\bin\dart.bat
that fixed it
Mac auto iCloud upload might be causing the error
If you are using Mac and if your Desktop files are being uploaded to iCloud automatically, sometimes iCloud uploads the "bin" file or the "cache" file inside the flutter file. I've just downloaded the file onto desktop (right click the file -> "Download Now") and it downloaded the file, it ran as usual. (Automatic upload can be turned off from system preferences if youn are getting this error frequently like I was).
For my case, i was using ubuntu, and after reading the above comments, i have come to a resolution that the above error comes as a result of permissions being blocked, accessing cmd with admin access levels solves the problem, e.g on linux run sudo flutter doctor and the problem will be solved.
This error occured to me when i tried upgrading my flutter so it needed admin rights to be upgraded nothing much