When I run in terminal flutter pub get is stuck it's showing
OS MacOS Catalina 10.15.3
Got TLS error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 1 in 1 second...
Got socket error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...
Got TLS error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 3 in 4 seconds...
Got socket error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 4 in 8 seconds...
Got socket error trying to find package launch_review at https://pub.dartlang.org.
Quick fixes before explanation:
Restart your router! Works for me several times.
Make sure your network is not behind a proxy
Make sure you can ping to pub.dev without any packet loss
Try to close all of your dart.exe processes before retying to perform the flutter pub get
Try to delete an existing package from your pubspec.yaml and re-get it to see if it works
Try to manually add the package to your project
So, I had (and sometime still having) the same issue. I've analyzed it and came to a conclusion that the package download manager and the server that hosts those packages aren't reliabe at all. Very small packages might just successfully be imported with "flutter pub get", whereas big ones might last forever to download. This is definately a networking issue, on either yours or their side.
Just for verificatioin that we are indeed experiencing the same issue:
open your cmd (no matter t OS) and run: ping -t pub.dev .Now, if you see those inconsitent replies from the server, it means there's something wrong with the network (yours or their side). This looks something like this:
Open up your task manager and look for the latest dart.exe task (it should be invoked the moment you flutter pub get. This task is the package that is being downloaded. If you see the process size never exceeding a certain size, and the get command is still stuck, it only indicates a network issue and the package might never be downloaded successfully. For example, my attempts to get the carousela_flutter 1.4.1 package ended up with a halted process size of around 60mb, looks this this:
If you wait for a relatively large amount of time (10 minutes I would say is enough) and the connectivity issue is still not resolved, you will see the following msg from flutter:
"Process finished with exit code 0".
I suggest you try another time or maually add the package.
p.s: it doesn't happen with all of the packages and from my investigation is seems to be related to the size of it. e.g, I managed to get the carousela_flutter 0.7.0 package, but the 1.4.1 failed.
In my case, The host of my ISP was blocked so it could not get the package and it was showing pub get failed (server unavailable) -- attempting retry 1 in 1 second...
So I turn on my VPN and tried once again and this time it was a success
If its a git error, use this command:
git config --global url."https://".insteadOf git://
More info here
502 Bad Gateway trying to find package package_name at https://pub.dartlang.org.
If you click on the link, you'll find that the website is down. The same is also applied to https://pub.dev/.
I´ve solved it on my Windows machine.
After many tries from answers in many discussions out there, I tried a lot of stuff, like:
Restarting the machine
Deleting the cache folder (the dart-sdk download may be restarted)
Adding dart-sdk in the Environment Variable Path
X:\Dev\Flutter\bin\cache\dart-sdk\
Adding dart-sdk´s bin folder in the Path variable (for both Environment and User Variables) (desperate action, I know)
X:\Dev\Flutter\bin\cache\dart-sdk\bin
And still didn´t work.
BUT... I´ve found on this thread something about a proxy problem.
Then I´ve decided to try it out on my Windows machine, and it worked (finally).
Try typing this on Power Shell:
$Env:https_proxy="your.proxy.here:8080"
Then try flutter doctor again
hmm, i know how frustrating it can be trying to solve the issue, the best solution to this is to use vpn and connect to another server. this way i was able to solve the problem without stress
As said it might be something that has to do with your network....
Disconnecting and reconnecting fixed mine.
Make sure no firewall is blocking it.
Check for Internet connectivity too. Search your browser, don't rely on the windows wifi symbol.
For me, KIS (Kaspersky) was blocking pub.bat.
If that is the case please also check---- Flutter, dart, android studio, Gradlew.bat, sdkmanager.bat, adb.exe, qemu-systems, emulator-check and google for any blockage. (just search in firewall settings).
In my case it was my virus program (AVG AntiVirus' Web Shield) that suddenly caused pub get to fail.
Because restaurant depends on flutter any from sdk which doesn't exist (unknown SDK "flutter"), version solving failed
fix proplem
done
change this package
this path prev last
path_provider_windows:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.5/lib/
change path fluatter plus /all
path
path_provider_windows:file:///C:/all/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.5/lib/
its ok
thanks
I was able to resolve it by using Visual Studio Debuggable Package Manager PowerShell, on your system open visual studio debuggable package manager and then type in flutter doctor it will resolve it within seconds
make sure there is no typo in pubpspec.yaml check it on here https://stackoverflow.com/a/72198419/8122500
Related
I installed flutter on a machine with a network, all tests and commands ( doctor, create, test ) run without problems. Then he took the directory where flutter was located and transferred it to a machine without an Internet connection. But with any call to flutter, it goes into
Running "flutter pub get" in flutter_tools.."
And does not leave this process. If you run it with the -vv flag, you can see that there is Resolving dependencies... The --offline flag does not help. I also tried to take .config, .pub-cache, .flutter from the machine where there is a connection and transfer it to the working one, but this did not help either. The question is, is there anything else that can be dragged and dropped as a dependency, or is there another way to run flutter offline?
Both machines are running Debian 9.
As I thought, all this is possible. The problem is in the wrong paths. When transferring the flutter working directory to another PC, you need to make sure that the paths are identical. Because in *packages/flutter_tools/ files there are many links in files on paths that correspond to downloads from the first machine.
Total what needs to be done:
Update flutter and dart
Run flutter precache
Copy the entire directory where flutter is located and ~$HOME/.pub-cache
Create the same path on the new machine and transfer the files.
Perform all necessary operations with the --offline flag
I have installed flutter 2 on my machine, and since this morning I have been receiving this error, when I try to give flutter pub get, in my terminal, or simply flutter doctor. I found several solutions on the internet but I don't know what it can be, and none of them solved my problem. I saw it on one of the sites that may be conflicting with antivirus, but I installed my new one yesterday, and it started to give error only today.
flutter doctor
Pub failed to rename directory because access was denied.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Running "flutter pub get" in flutter_tools...
pub get failed (1; in the directory open in another application.)
There were GitHub issues that was filed before relating to this. There were no proper solutions to this, instead you can try some solutions that was mentioned in the following issue tickets:
https://github.com/dart-lang/pub/issues/1798
https://github.com/flutter/flutter/issues/16100
You can try one of the solution mentioned in this GitHub thread:
Try to run flutter pub cache repair.
There is another ticket that is still open for the troubleshooting to be added in the Flutter documentation for reference of everyone. And to be considered as the universal solution for this problem.
When running a new application "flutter pub get" in Vscode keeps running without completion.I have tried flutter clean , and reopening vscode.
I think you have to check the proper package name. Maybe you misspelled the package name or else your internet is not working fine.
I was facing same issue, I checked all package names, they were correct. I did run flutter clean and then flutter pub get and it's worked. Hope! this might be helpful if some one faces same issue as I was.
Try flutter clean command, also remove pubspec.lock file in root directory then re-run this command flutter pub get.
Actually it would be the issue related to the network rules in your system. means issue is related to IT team. they will unblock your firewall or use network proxy to fix this issue.
While my normal internet connection took more than 15 minutes, I connected to vpn from a different country and tried flutter pub get. It worked pretty fast.
I got the same issue and I resolved it by synchronizing date and hours of my computer.
With an incorrect date, you can have some network issues.
(My computer's date was set to 'yesterday')
On Linux, this worked for me and for many other people...
It should work for you too.
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
On windows, you should create an environment variable with:
name: PUB_HOSTED_URL
value: https://pub.flutter-io.cn
name: FLUTTER_STORAGE_BASE_URL
value: https://storage.flutter-io.cn
#Code gotten from MathiasGodwin on Grepper
Step 1: flutter clean
step 2: remove pubspec.lock
step 3: If your project has lots of dependencies then load 1 or 2 at once .
It can happen because of lots of dependencies and slow internet connection.
I disconnected from the VPN and it worked for me.
I can't use anymore flutter clean or doctor in command line in Android Studio 3.6.1.
When I try I have this message :
Downloading windows-x64/font-subset tools...
Download failed.
URL: https://storage.googleapis.com/flutter_infra/flutter/e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/windows-x64/font-subset.zip
Error: 404 Not Found
I try to use gradlew clean. I had exactly the same message.
By the way flutter structure is empty when I open a flutter file and I don't have any completion or shortcut to go to functions (message: cannot find declaration to go to).
Do you have any clue to why it's happen and how to fix it?
Thanks
I found a solution.
I remove flutter.
I reinstall it and it's worked now.
If someone now why that's happen I am interested.
That's happened for some network issue, your network can not access the server.
More Details: https://github.com/flutter/flutter/issues/48030
Hope you will find your all answers and solutions.
I can't run all of my flutter apps, because in the console appears everytime this error message:
Downloading Gradle Wrapper... 1,2s
Launching lib\main.dart on SM G960F in debug mode...
Running Gradle task 'assembleDebug'...
Finished with error: Unable to locate gradlew script. Please check that C:\Users\...\android\gradlew.bat exists or that C:\Users\...\android can be read.
I try to fix this problem more than ten hours and don't find a solution.
I will advise you to check your pc properly for unwanted programs. Something is preventing your pc from running the Gradle. I had the same issue only to realize that antivirus was installed on my pc alongside a cd burner that I just installed. Check for any antivirus that might be preventing Gradle from running.
I also faced the same error initially. While creating a flutter application from scratch I just ran the default flutter application which is a counter app in a flutter. I faced the same issue at first. If you are in this same context as described earlier the following could be the solution
1.Java 8 is more suitable for the flutter/android development. The next versions of java have some exceptions. I used the Java 14 and stuck at this issue for some time
The next could be the JAVA_HOME path in your environment variables. If it is not provided the set the JAVA_HOME path.
Run flutter --doctor and check the requirements if satisfied like Android SDK is updated or not, upgrade flutter if required. In some cases having good Internet connection also plays a role in this issue some times.
These are the major points to be satisfied in order to get rid of this error. Mostly this could be the a solution or part of it.
The error suggests that something is preventing gradle to run properly on your machine. Check whether you have any unwanted programs or anti-virus on your machine running that might be preventing gradle to run. If so, remove or stop those programs / anti-virus and try again.
After that, delete the .gradle folder located here C:\Users\yourPcName\.gradle containing the unfinished file and try again . It will work now .
You can also manually download Gradle and map it in Android studio , Learn more with this article here .
Warning, the gradle versions change quickly, so make sure you manually
downloaded the exact version that flutter wanted to download and the
download failed. Download the gradle here and then replace it in the
gradle folder.
C:\Users\yourPcName\.gradle\wrapper\dists\gradle-x.x.x-all
If it still doesn't work,
Try to run flutter --doctor
From a console window that has the Flutter directory in the path (see above), run the following command to see if there are any platform dependencies you need to complete the setup:
C:\src\flutter> : flutter doctor
This command checks your environment and displays a report of the status of your Flutter installation. Check the output carefully for other software you might need to install or further tasks to perform (shown in bold text).
You can learn more here :
If flutter doctor itself doesn't work, then know that flutter is not installed on your machine (or you forgot to add it to the environment
variable).
I also faced this problem and I made something to run my app on android
tried to open anything on android files and android studio ask me if I want to open for editing android file in android studio then click on it and it will open android project then click run enter image description here