I just installed Flutter, and as soon as I try to launch the application on Windows, it loses the connection.

I just installed Windows, Flutter, and Visual Studio. flutter doctor shows everything is fine, it compiles, but when I try to launch the app on windows, it automatically loses the connection. I’ve tried everything, and I don’t know what’s happening. I would appreciate any help. Thanks, regards.

Launching lib\main.dart on Windows in debug mode…
√ Built build\windows\x64\runner\Debug\flutter_application_1.exe
Connecting to VM Service at ws://127.0.0.1:50108/FEl_shxjOfA=/ws
Connected to the VM Service.
Lost connection to device.

Unhandled exception:
SocketException: Connection attempt cancelled, host: www.google-analytics.com, port: 443
#0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:824:35)
#1 _RawSocket.startConnect (dart:io-patch/socket_patch.dart:2292:26)
#2 RawSocket.startConnect (dart:io-patch/socket_patch.dart:41:23)
#3 RawSecureSocket.startConnect (dart:io/secure_socket.dart:334:22)
#4 SecureSocket.startConnect (dart:io/secure_socket.dart:85:28)
#5 _ConnectionTarget.connect (dart:_http/http_impl.dart:2687:30)
#6 _HttpClient._getConnection.connect (dart:_http/http_impl.dart:3208:12)
#7 _HttpClient._getConnection (dart:_http/http_impl.dart:3213:12)
#8 _HttpClient._openUrl (dart:_http/http_impl.dart:3036:12)
#9 _HttpClient.openUrl (dart:_http/http_impl.dart:2858:7)
#10 IOClient.send (package:http/src/io_client.dart:117:38)
#11 BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:38)
#12 BaseClient.post (package:http/src/base_client.dart:32:7)
#13 GAClient.sendData (package:unified_analytics/src/ga_client.dart:66:28)
#14 AnalyticsImpl.send (package:unified_analytics/src/analytics.dart:622:38)
#15 _handleToolError (package:flutter_tools/runner.dart:198:23)
#16 run.. (package:flutter_tools/runner.dart:131:15)
#17 _rootRunBinary (dart:async/zone.dart:1560:47)
#18 _CustomZone.runBinary (dart:async/zone.dart:1436:19)
#19 runZonedGuarded. (dart:async/zone.dart:2002:18)
#20 _Zone._processUncaughtError (dart:async/zone.dart:1178:14)
#21 _CustomZone.handleUncaughtError (dart:async/zone.dart:1399:5)
#22 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1331:7)
#23 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#24 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#25 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:67:11)
#26 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#27 _StringAdapterSink.add (dart:convert/string_conversion.dart:228:11)
#28 _LineSplitterSink._addLines (dart:convert/line_splitter.dart:167:13)
#29 _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:134:7)
#30 StringConversionSink.add (dart:convert/string_conversion.dart:39:5)
#31 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:115:24)
#32 _rootRunUnary (dart:async/zone.dart:1538:47)
#33 _CustomZone.runUnary (dart:async/zone.dart:1429:19)
#34 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329:7)
#35 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#36 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#37 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:67:11)
#38 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#39 _StringAdapterSink.add (dart:convert/string_conversion.dart:228:11)
#40 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:233:7)
#41 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:313:20)
#42 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:306:5)
#43 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:70:18)
#44 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:115:24)
#45 _rootRunUnary (dart:async/zone.dart:1538:47)
#46 _CustomZone.runUnary (dart:async/zone.dart:1429:19)
#47 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329:7)
#48 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#49 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#50 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:798:19)
#51 _StreamController._add (dart:async/stream_controller.dart:663:7)
#52 _StreamController.add (dart:async/stream_controller.dart:618:5)
#53 _Socket._onData (dart:io-patch/socket_patch.dart:2904:41)
#54 _rootRunUnary (dart:async/zone.dart:1546:13)
#55 _CustomZone.runUnary (dart:async/zone.dart:1429:19)
#56 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1329:7)
#57 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:381:11)
#58 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:312:7)
#59 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:798:19)
#60 _StreamController._add (dart:async/stream_controller.dart:663:7)
#61 _StreamController.add (dart:async/stream_controller.dart:618:5)
#62 new _RawSocket. (dart:io-patch/socket_patch.dart:2323:31)
#63 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1646:14)
#64 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#65 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#66 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:128:13)
#67 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:195:5)

Exited (255).

[ +437 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at
http://127.0.0.1:50211/p2DFUaeCNsY=/.
[+4984 ms] Warning: Failed to start DDS: Failed to start Dart Development Service
[ +2 ms] Fail to connect to service protocol: http://127.0.0.1:50211/p2DFUaeCNsY=/: DartDevelopmentServiceException: Failed
to start Dart Development Service
[ +3 ms] Error connecting to the service protocol: failed to connect to http://127.0.0.1:50211/p2DFUaeCNsY=/
DartDevelopmentServiceException: Failed to start Dart Development Service
[ +14 ms] “flutter run” took 53.060ms.
[ +101 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:34:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:931:9)

#2 FlutterCommand.run.
(package:flutter_tools/src/runner/flutter_command.dart:1558:27)

#3 AppContext.run. (package:flutter_tools/src/base/context.dart:154:19)

#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#5 FlutterCommandRunner.runCommand.
(package:flutter_tools/src/runner/flutter_command_runner.dart:496:9)

#6 AppContext.run. (package:flutter_tools/src/base/context.dart:154:19)

#7 FlutterCommandRunner.runCommand
(package:flutter_tools/src/runner/flutter_command_runner.dart:431:5)

#8 run.. (package:flutter_tools/runner.dart:98:11)

#9 AppContext.run. (package:flutter_tools/src/base/context.dart:154:19)

#10 main (package:flutter_tools/executable.dart:99:3)

[ +55 ms] Running 3 shutdown hooks
[ +11 ms] Shutdown hooks complete
[ +107 ms] exiting with code 2

Does fluttter build windows work?

If yes, could you try running the app using Visual Studio directly?

  1. Open ./build/windows/ALL_BUILD.vcxproj in Visual Studio. This project builds the native entry point for your Flutter app.

  2. In the Solution Explorer, right click on the project whose name matches your app, and select Set as Startup Project.

    In the screenshot above, my app is called debug_example. Your app will likely have a different name!

  3. Now run your app by pressing F5 or DEBUG > Start Debugging. This should start your app with Visual Studio’s debugger attached.

Does this crash? If so, what’s the crash?