Massaget
Massaget

Reputation: 378

Flutter taking an unexpectedly long time for connecting to browser

I'm building flutter web project and after implenting login page via firebase I ran flutter run -d chrome. But it's stuck while attempting to connect to browser, its just attempting for endless time without giving any error messages. Status bar:

λ flutter run -d chrome
Launching lib\main.dart on Chrome in debug mode...
Building application for the web...                                20,2s
Attempting to connect to browser instance..                             
(This is taking an unexpectedly long time.)       \

Flutter doctor:

λ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v1.10.11-pre.2, on Microsoft Windows [Version 10.0.18362.356], locale ru-RU)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.

[√] Chrome - develop for the web
[!] Android Studio (not installed)
[√] VS Code (version 1.38.1)
[√] Connected device (2 available)

! Doctor found issues in 2 categories.

pubspec.yaml:

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase: ^5.0.0
  firebase_auth: 

Upvotes: 17

Views: 15626

Answers (6)

Nauman Asghar
Nauman Asghar

Reputation: 3

I have fixed that issue by installing the latest JDK and JRE and added both path to environment variables. it fixes my flutter speed but flutter run and apk building still taking the same.

Upvotes: 0

skillworks
skillworks

Reputation: 382

Same issue: It use to take lot of time to load and 'r', the hot reload command never worked.

For me cleaning builds by "flutter clean" did the magic.

Upvotes: 0

Shashwat Aditya
Shashwat Aditya

Reputation: 406

  1. Remove all unused dependencies
  2. flutter run -d web-server

The answer mentioned by @Giampaolo is a great workaround!

Upvotes: 8

Giampaolo
Giampaolo

Reputation: 133

Try with flutter run -d web-server, then open URL on Chrome manually.

Upvotes: 9

ajs.sonawane
ajs.sonawane

Reputation: 317

Same issue . It wasn't able to get the instance of browser.

I tried removing unused imports, in my case "import 'dart:ffi';" this was the unused import and ta daa ... it worked !!!.

i just don't know what exactly the problm was.

Upvotes: 1

x23b5
x23b5

Reputation: 709

Same issue here. When trying the sample project, it works. I think the problem has something to do with dependencies, but have not figured out in detail.

Update: Could be related: https://github.com/flutter/flutter/issues/40876 and https://github.com/flutter/flutter/issues/39998

Update #2: I could reproduce the issue a described in https://github.com/flutter/flutter/issues/39998

1) Create fresh flutter project with web support -> works.

2) add import 'dart:io'; to main.dart -> blank screen

Upvotes: 2

Related Questions