问题
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...
Android studio log
回答1:
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
回答2:
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!
回答3:
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
回答4:
I fix that by:
Cntr+Cto stop infinite error loop.- Kill the Dart process in Windows Task Manager.
- Delete the
cachefolder located influtter/bindirectory. - 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.
回答5:
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
回答6:
Just delete the cache folder in flutter/bin and run flutter doctor again!!
回答7:
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!!
回答8:
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.
回答9:
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.
回答10:
Strangly when I kill the dart process in Windows Task Manager it is working. But sometimes even when dart process is running update working.
回答11:
I had to turn off the Android Emulator. It was running for me...
回答12:
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.
回答13:
Manually downloading the SDK from flutter website fixed the issue.
Still dont know why this problem occured tho.
回答14:
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.
回答15:
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
回答16:
Just Deactivate your antivirus and run it again. It would work fine. I had the same issue before.
来源:https://stackoverflow.com/questions/49497109/error-unable-to-pub-upgrade-flutter-tool-retrying-in-five-seconds