我正在构建Flutter Web项目,并通过firebase设置登录页面后,我运行了flutter run -d chrome。 但是它在尝试连接到浏览器时被卡住了,只是尝试了无休止的时间而没有给出任何错误消息。状态栏:
λ 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
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:
答案 0 :(得分:6)
flutter run -d web-server
@Giampaolo提到的答案是一个很好的解决方法!
答案 1 :(得分:3)
尝试使用Text
,然后在Chrome上手动打开URL。
答案 2 :(得分:1)
同一问题。尝试示例项目时,它可以工作。我认为该问题与依赖关系有关,但尚未详细解决。
更新: 可能相关:https://github.com/flutter/flutter/issues/40876 和https://github.com/flutter/flutter/issues/39998
更新#2: 我可以重现 https://github.com/flutter/flutter/issues/39998
1)在Web支持下创建新的flutter项目-> Works。
2)将import 'dart:io';
添加到main.dart->黑屏
答案 3 :(得分:1)
同一期。无法获取浏览器实例。
我尝试删除未使用的导入,在本例中为“ import'dart:ffi';”这是未使用的导入和ta daa。。。
我只是不知道问题到底是什么。
答案 4 :(得分:0)
同一问题:加载和'r'花费大量时间,hot reload命令从未起作用。
对我来说,用“颤抖的清洁”来清洁建筑是不可思议的。
答案 5 :(得分:0)
我通过安装最新的 JDK 和 JRE 解决了这个问题,并将这两个路径都添加到了环境变量中。它修复了我的颤振速度,但颤振运行和 apk 构建仍然保持不变。