I recently migrated to Linux Ubuntu 22.04. I installed Flutter and Android Studio successfully, but when I try to run a project, it throws an exception error.
Exception in thread "main" java.net.SocketExpection: Connection reset
When I also run flutter doctor
, the HTTP Host Availability is flagged. Below is my flutter doctor
log.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel main, 3.4.0-19.0.pre.295, on Ubuntu 22.04.1 LTS 5.15.0-47-generic, locale en_US.UTF-8)
Checking Android licenses is taking an unexpectedly long time...
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] VS Code
[✓] Connected device (3 available)
HTTP Host availability check is taking a long time...
[☠] HTTP Host Availability (the doctor check crashed)
✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at
https://github.com/flutter/flutter/issues.
✗ Exception: HTTP Host Availability exceeded maximum allowed duration of 0:04:30.000000
! Doctor found issues in 1 category.
P.S.
At the moment I was running flutter doctor
, I was connected to the internet.
2
Answers
Try Running
flutter pub get
I was facing the same issue. It was resolved when I did this
Open ${FLUTTER Folder}packagesflutter_toolslibsrchttp_host_validator.dart
Change https://maven.google.com/ to https://dl.google.com/dl/android/maven2/
Close Terminal
Open ${FLUTTER_HOME}bin and delete cache directory
Reopen Terminal and exec flutter doctor