Finished with error: 无法与 Chrome 中的应用程序实例建立连接。如果 Web 工具使用的 websocket 连接无法正确建立连接(例如由于防火墙),就会发生这种情况。
当我在 chrome 浏览器上运行我的 flutter web 应用程序时,我收到了这个错误。即使没有解决我的问题,我也关闭了我的防火墙。
解决此错误的可能解决方案是什么?
我尝试过的临时解决方案:
从开发频道升级到主频道时遇到了这个问题。我为解决这个问题所做的是清理我的项目的构建缓存(flutter clean),然后使用发布模式运行该项目。之后,我可以在调试模式下运行它。
这暂时解决了我的问题,一段时间后我仍然面临同样的问题。实施相同的解决方案并没有解决我的问题。
有人可以帮我吗?我尝试使用 Flutter 构建一个基于 Google Firebase Auth 和 Cloud Firestore 的 Web 应用程序。Android 上的项目运行良好,我可以与用户合作并可以从我的 Cloud Firestore 数据库中获取数据。我制作了第二个应用程序 (webapp) 执行 Firebase 文档中描述的所有步骤(webapp 已注册,托管在 Firebase 上),在 pubspec.yaml 中插入所有依赖项
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
firebase_core: ^0.4.4+3
firebase: ^7.3.0
firebase_auth: ^0.16.0
Run Code Online (Sandbox Code Playgroud)
像这样修改了 index.html:
<body>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="/__/firebase/7.14.3/firebase-app.js"></script>
<!-- TODO: …Run Code Online (Sandbox Code Playgroud)