【问题标题】:Flutter project doesn't open on ChromeFlutter 项目无法在 Chrome 上打开
【发布时间】:2021-07-19 00:54:30
【问题描述】:

自从我一直在努力解决这个问题并尝试了 StackOverflow 上的所有解决方案以来已经 5 天了,但仍然无法在 Chrome 上打开应用程序: 我尝试过的。如果您能提供帮助,我将不胜感激。

  1. 我尝试过 HTML 文件,chrome 可以无缝打开,但 Flutter 出现问题。
  2. 安装实时服务器扩展:错误
  3. Flutter run -d chrome:错误
  4. 并排配置不正确:安装 Visuall c++ update 和 regedit
  5. 在 Launch.json 上更改 chrome 路径
  6. flutter 通道稳定,已升级。

错误 1:

CreateProcessW failed 14001
ProcessException: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

  Command: C:\Users\abc\AppData\Local\Google\Chrome\Application\chrome.exe --user-data-dir=C:\Users\abc\AppData\Local\Temp\flutter_tools.b64ea32a\flutter_tools_chrome_device.7ecc71a0 --remote-debugging-port=13587 --disable-background-timer-throttling --disable-extensions --disable-popup-blocking --bwsi --no-first-run --no-default-browser-check --disable-default-apps --disable-translate http://localhost:13570


Flutter doctor -v

[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [Version 10.0.19042.867], locale en-US)
    • Flutter version 2.0.5 at C:\src\flutter
    • Framework revision adc687823a (9 days ago), 2021-04-16 09:40:20 -0700
    • Engine revision b09f014e96
    • Dart version 2.12.3

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) 
    • Android SDK at C:\Users\abc\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java       
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Users\abc\AppData\Local\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.55.2)
    • VS Code at C:\Users\abc\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.21.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.85
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 90.0.818.42

【问题讨论】:

  • 你能用flutter doctor -v的输出更新问题吗
  • 谢谢,Edge 是否也会出现同样的问题,还是 Chrome 特有的问题?如果想要快速解决此问题,即只是让应用程序在浏览器中呈现,您也可以尝试 flutter run -d web-server,这将在 localhost 上的随机端口上启动服务器。
  • 在控制台中应该有一个 url,您可以使用它在浏览器中打开应用程序。你也给了它一些时间吗? Flutter 必须下载大量资源,并且可能会在后台加载!
  • 您能确认浏览器检查器的网络选项卡中没有加载任何内容吗?

标签: flutter google-chrome flutter-web flutter-doctor


【解决方案1】:

因为颤振医生没有显示任何环境错误。错误可能发生在应用程序启动或初始化插件时。

  1. 检查 chrome 浏览器是否在控制台上显示任何消息 2,确保您已按照其网站或 pub.dev 页面上的说明设置了所有插件。

特别是 Firebase 有一个扩展配置,其中涉及在您的颤振项目的 index.html 中添加额外的 .js 文件。由于您的项目是一个网络项目,请查看 this link 以获取有关如何将 Firebase 添加到您的应用的完整说明。

请尝试上述步骤,如果有任何变化,请告诉我们

【讨论】:

  • 你太有帮助了,兄弟。我真的很感激你所做的......是的,问题是我没有将 Sdk 添加到 index.html ......
【解决方案2】:

首先,如果运行完美,请使用此行flutter doctor 签入命令提示符/cmd。那么,

  1. 在您的 Android Studio 终端中写入 flutter config --enable-web 然后关闭您的 Android Studio/IDE

  2. 您也可以在 cmd flutter devices 中签入此图像 flutter devices

  3. 打开您的 Android Studio,然后选择您的浏览器 select your browser

希望能解决您的问题。谢谢。

【讨论】:

    猜你喜欢
    • 2019-09-29
    • 2021-09-26
    • 2021-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-10
    • 2018-07-19
    相关资源
    最近更新 更多