I'm attempting to run this Flutter To-Do list app in Visual Studio Code:
And I'm encountering this error:
I/flutter (30973): Observatory server failed to start after 11 tries
I/flutter (30973): Could not start Observatory HTTP server:
I/flutter (30973): SocketException: Failed to create server socket (OS Error: Operation not permitted, errno = 1), address = 127.0.0.1, port = 0
[38;5;244mI/flutter (30973): #0 _NativeSocket.bind (dart:io-patch/socket_patch.dart:736:7)[39;49m
I/flutter (30973): <asynchronous suspension>
[38;5;244mI/flutter (30973): #1 _RawServerSocket.bind (dart:io-patch/socket_patch.dart:1394:26)[39;49m
[38;5;244mI/flutter (30973): #2 _ServerSocket.bind (dart:io-patch/socket_patch.dart:1676:29)[39;49m
[38;5;244mI/flutter (30973): #3 ServerSocket._bind (dart:io-patch/socket_patch.dart:1667:26)[39;49m
[38;5;244mI/flutter (30973): #4 ServerSocket.bind (dart:io/socket.dart:382:27)[39;49m
[38;5;244mI/flutter (30973): #5 _HttpServer.bind (dart:_http/http_impl.dart:2701:25)[39;49m
I/flutter (30973): #6 HttpServer.bind (dart:_http:229:19)
[38;5;244mI/flutter (30973): #7 Server.startup.poll (dart:vmservice_io/vmservice_server.dart:410:36)[39;49m
I/flutter (30973): <asynchronous suspension>
I/flutter (30973): #8 Server.startup.poll (dart:vmservice_io/vmservice_server.dart)
[38;5;244mI/flutter (30973): #9 Server.startup (dart:vmservice_io/vmservice_server.dart:422:23)[39;49m
I/flutter (30973): <asynchronous suspension>
I/flutter (30973): #10 main (dart:vmservice_io:262:12)
I'm running Windows 10 Home.
After doing some digging on the issue I have tried:
- Disabling antivirus (Windows Defender in my case)
- Disabling the firewall (Again Windows Defender)
- Followed suggestions from this post: https://stackoverflow.com/questions/55119887/observatory-server-failed-to-start-fails-to-create-socket-server
No success here.
On all my debug, main and profile AndroidManifest.xml files I have:
...
<uses-permission android:name="android.permission.INTERNET" />
...
Except on the main one I have:
...
<uses-permission android:name="android.permission.INTERNET" android:maxSdkVersion="18" />
...
On my pubsec.yaml file I have:
...
environment:
sdk: ">=2.2.0 <3.0.0"
...
On my android/app/build.gradle file I have:
...
android {
compileSdkVersion 28
...
Flutter Doctor:
[β] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18363.836], locale en-US)
β’ Flutter version 1.17.1 at C:\SDK\FlutterSDK\flutter
β’ Framework revision f7a6a7906b (4 weeks ago), 2020-05-12 18:39:00 -0700
β’ Engine revision 6bc433c6b6
β’ Dart version 2.8.2
[β] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
β’ Android SDK at C:\Users\y_cha\AppData\Local\Android\sdk
β’ Platform android-29, build-tools 29.0.3
β’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
β’ Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
β’ All Android licenses accepted.
[β] Android Studio (version 3.6)
β’ Android Studio at C:\Program Files\Android\Android Studio
β’ Flutter plugin version 45.1.1
β’ Dart plugin version 192.8052
β’ Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[β] VS Code (version 1.45.1)
β’ VS Code at C:\Users\y_cha\AppData\Local\Programs\Microsoft VS Code
β’ Flutter extension version 3.11.0
[β] Connected device (2 available)
β’ SM G975F β’ R58M43954DX β’ android-arm64 β’ Android 10 (API 29)
β’ Android SDK built for x86 β’ emulator-5554 β’ android-x86 β’ Android 10 (API 29) (emulator)
β’ No issues found!
Gradle version:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
This issue happens on both the android emulator and my physical device.
I have seen this issue show up in many searches, but I haven't seen a definitive solution.
Anyone with any knowledge of a solution to this please help.
Thanks.