Flutter web run in chrome? - flutter

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

Related

Launch emulator from windows command line receive error G67247B7E

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!

flutter CMakeLists.txt

when I try to run the desktop application in a flutter. i write on terminal flutter run -d windows
give this the below error
Launching lib\main.dart on Windows in debug mode...
Nuget is not installed.
CMake Error at flutter/ephemeral/.plugin_symlinks/desktop_webview_auth/windows/CMakeLists.txt:28 (message):
Integrity check for E:/Kabbee/Kp_Destop_App/build/windows/nuget.exe failed.
Building Windows application...
Exception: Unable to generate build filesenter image description here

Can't sync android emulator with flutter project

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

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
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

Start android emulator without starting Android Studio for flutter applications

Is it possible to start emulator in such a way flutter doctor detects it and flutter run should able to deploy to flutter code ?
I tried emulator -avd *image name* but flutter doctor fails to detect running emulator and flutter run does not deploys code on emulator.
In notepad type the following and save it as "file_name.bat" and run it:
SET builddir=%~dp0
SET EX="C:\Users\user_name\AppData\Local\Android\Sdk\emulator\emulator.exe"
CALL %EX% -avd emu_name -partition-size 512 -feature WindowsHypervisorPlatform
pause
emu_name is the name of your emulator.
first you must change directory of your command line to ${android_SDK_DIR}\emulator
most of the time its in c:\users\${yourUserName}\AppData\Local\Android\SDK\
and run emulator -list-avds and it show you your emulator that you create before in android studio then just run emulator #${your emulator name that shows on the list} for example emulator #Nexus6_API_27
remember that maybe your android sdk folder directory was change on install SDK and if you don't create emulator in android studio before , the list will be empty so before you run command you must create AVD in your android studio
It looks like an adb issue, not of the Flutter doctor issue. Because if adb is running perfectly then it would show you a list of devices from android studio or from flutter devices or by running a adb devices command.
You can try restarting adb using commands:
adb kill-server and
then adb start-server
I think the easiest method I found is you just go to cmd
flutter emulator -- launch <emulator id
it will run and will be detected by your intelli j
I have to get an answer in here somehow, even if it's to offer that the command may also be plural. Yes, indeed, you can run "flutter emulators" from your flutter\bin directory (if you haven't added to system PATH yet) and voila...
PS C:> flutter emulators 1 available emulator:
Pixel_2_API_28 • pixel_2 • Google • Pixel 2 API 28
To run an emulator, run 'flutter emulators --launch '. To
create a new emulator, run 'flutter emulators --create [--name xyz]'.
You can find more information on managing emulators at the links
below: https://developer.android.com/studio/run/managing-avds
https://developer.android.com/studio/command-line/avdmanager