Muhammad Salman
Muhammad Salman

Reputation: 91

Failed to establish connection with the application instance in Chrome

Failed to establish connection with the application instance in Chrome. This can happen if the websocket connection used by the web tooling is unable to correctly establish a connection, , for example due to a firewallfor example due to a firewall.

i am getting this error whenever i run flutter web application on chrome in debug mode. i disable firewall and still not working, but when i run it in release mode its work. can anyone help me please! i am using window 8.1 64bit

Upvotes: 1

Views: 4464

Answers (3)

Philip Valentino
Philip Valentino

Reputation: 11

this worked for me ( no firewall issue, no Dart Debug Extension installed )

➜ somefolder flutter run -d chrome

Launching lib/main.dart on Chrome in debug mode... Waiting for connection from debug service on Chrome... 125.9s

Failed to establish connection with the application instance in Chrome. This can happen if the websocket connection used by the web tooling is unable to correctly establish a connection, for example due to a firewall.

➜ somefolder flutter clean

Cleaning Xcode workspace... 39.2s Deleting build... 712ms Deleting .dart_tool... 97ms Deleting .packages... 0ms Deleting Generated.xcconfig... 16ms Deleting flutter_export_environment.sh... 0ms

➜ somefolder flutter devices

1 connected device:

Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.128

➜ somefolder flutter run -d chrome --release

Running "flutter pub get" in somefolder... 10.8s Launching lib/main.dart on Chrome in release mode... Compiling lib/main.dart for the Web... 38.3s

🔥 To hot restart changes while running, press "r" or "R". For a more detailed help message, press "h". To quit, press "q".

Performing hot restart... 5.5s Restarted application in 5,489ms.

Performing hot restart... 394ms Restarted application in 394ms.

Performing hot restart... 375ms Restarted application in 375ms.

Application finished.

➜ somefolder flutter run -d chrome

Launching lib/main.dart on Chrome in debug mode... Waiting for connection from debug service on Chrome... 37.9s Debug service listening on ws://127.0.0.1:64242/GMDUxFrKo2U=/ws

Running with unsound null safety For more information see https://dart.dev/null-safety/unsound-null-safety

🔥 To hot restart changes while running, press "r" or "R". For a more detailed help message, press "h". To quit, press "q".

Upvotes: 1

Carlos N.
Carlos N.

Reputation: 1307

What seems to solve the issue is running the following commands inside your flutter project directory:

flutter clean

flutter run -d chrome --release

After running the first time in the release mode, you can then run in the debug mode with just:

flutter run -d chrome

Reference: https://github.com/flutter/flutter/issues/49482

Upvotes: 4

Mobasshir Imam
Mobasshir Imam

Reputation: 49

You need not to disable firewall, You have to download Dart Debug Extension on Google Chrome then run flutter app on web

Upvotes: 0

Related Questions