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
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
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".
You need not to disable firewall,
You have to download Dart Debug Extension on Google Chrome then run
flutter app on web
Related
I'm starting developing mobile using flutter on vscode IDE. I was debbuging the app using a samsung device, everything was ok, but I tryed debug the app using a xiaomi device, however this time i've got an error
Launching lib/main.dart on 166216e0 in debug mode...
Built build/app/outputs/flutter-apk/app-debug.apk.
adb: insufficient permissions for device: missing udev rules? user is in the plugdev group
See [http://developer.android.com/tools/device.html] for more information
Error: ADB exited with exit code 1
adb: insufficient permissions for device: missing udev rules? user is in the plugdev group
See [http://developer.android.com/tools/device.html] for more information
Error launching application on 166216e0.
Exited (sigterm)
There's a difference of android version. Samsung is android 11 and xiaomi is a MIUI Global 12.0.4 android 10.
apart from having usb debug enabled, i've enabled the option to install via usb and usb debugging.
I don't know how to solve this. Any suggestion?
I've updated SDK Manager adding android 10
after that i runned
flutter doctor --android-licenses
but I still not working
Newbee here. Trying to run the android emulator for the generic first_app flutter application.
Run flutter run -d windows
Receive:
C:\Development\Flutter\first_app>flutter run -d windows
Launching lib\main.dart on Windows in debug mode...
lib/main.dart(60,15): error G67247B7E: Expected ';' after this. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): error MSB8066: Custom build for 'C:\Development\Flutter\first_app\build\windows\CMakeFiles\13756e3632117b79f6e0bc292bc438e0\flutter_windows.dll.rule;C:\Development\Flutter\first_app\build\windows\CMakeFiles\f154f6c681490929a1ff6491e40cd6b3\flutter_assemble.rule' exited with code 1. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
Building Windows application...
Exception: Build process failed.
Other information:
Flutter Doctor is clean. That took hours.
Running from Android Studio works.
Launching emulator works correctly
Have tried Flutter Clean, Flutter upgrade, Flutter Master.
Have tried running from powershell with the same error.
Any assistance welcomed.
First you can check if the emulator is running or not by this command
flutter devices
Then you can directly run your app through
flutter run -d device-id
In my case, it was
flutter run -d emulator-5554
All, on a whim, I deleted my first_app and created it again via flutter create first_app.
Immediately running flutter run, it works!
I use flutter on window 10, when i run flutter on console and perform flutter run -d chrome, the error is waiting for connection from debug service on chrome. The error from chrome page show "The connection cant be reach".
My flutter doctor show i didnt install Visual Studio, but i already used to the Visual Studio Code. Is it a must to install Visual Studio ? Other than that, everything is passed.
I try to run the app on Visual Studio Code, the error is the same. Even on edge, on web-server. The error is the same.
I try to add Dart Debug Extension on Chrome but cannot be enable. Can some help ?
My flutter run -d chrome --verbose show below :
[tag:C:\Users\Administrator\myflutter_app>flutter run -d chrome --verbose
[ +10 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+19685 ms] Waiting for connection from debug service on Chrome... (completed in 20.0s)
[ +2 ms] Synced 30.6MB.
[ +1 ms] <- accept
[ ] Caching compiled dill
[+2477 ms] [CHROME]:
[ +18 ms] [CHROME]: DevTools listening on ws://127.0.0.1:57469/devtools/browser/51db6ac9-54b7-4fb7-bdb4- 25fb1707d9d6]
The problem can be solved by performing the following actions
Upgraded flutter to latest version
Reinstall android studio
run flutter pub upgrade --major-versions
upgrade your chrome to latest
if you are using any extension in VS code to run flutter then there is also a possibility that the extension is not working properly try to change the version.
If it works give me a upvote,I'm new here.
Launching lib\main.dart on Chrome in debug mode...
lib\main.dart:1
Failed to launch browser after 3 tries. Command used to launch it: C:\Users\admin\AppData\Local\Google\Chrome\Application\chrome.exe --user-data-dir=C:\Users\admin\AppData\Local\Temp\flutter_tools.d39b26cf\flutter_tools_chrome_device.96f3921c --remote-debugging-port=55848 --disable-background-timer-throttling --disable-extensions --disable-popup-blocking --bwsi --no-first-run --no-default-browser-check --disable-default-apps --disable-translate http://localhost:55815
Failed to launch browser. Make sure you are using an up-to-date Chrome or Edge. Otherwise, consider using -d web-server instead and filing an issue at https://github.com/flutter/flutter/issues.
flutter config --enable-web
Add this
Could Not Find C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\AdbWinApi.dll.dat
The directory name is invalid.
W/FlutterActivityAndFragmentDelegate( 9139): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Error waiting for a debug connection: ProcessException: adb returned error:
The directory name is invalid.
Could Not Find C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\AdbWinApi.dll.dat
Command: C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:0 tcp:42601
Error launching application on Android SDK built for x86.
Exited (sigterm)
I solved this issue by the following 3 steps:
1 remove the sdk and emulator.
2 install again the sdk and emulator.
3 restart my computer
and then then solved it