从 flutter 1.9 开始:如何 运行 在浏览器中使用 flutter app?扑 运行 -d chrome 不工作
Since flutter 1.9 : how to run flutter app in a browser ? Flutter run -d chrome not working
自 flutter 1.9 flutter_web 合并到 flutter 中。我正在尝试在 chrome 浏览器中 运行 初始 flutter 应用程序,但它失败了。 OS 是 ubuntu 19.04
我成功使用的命令:
扑动升级
flutter 创建test_1_9
cd test_1_9
颤动运行
命令无效:
颤振运行-dchrome
=> 找不到名称或 ID 匹配 'chrome'
的设备
我尝试使用 google-chrome 作为设备名称,结果相同
[✓] Flutter (Channel master, v1.10.2-pre.38, on Linux, locale fr_FR.UTF-8)
• Flutter version 1.10.2-pre.38 at /home/rbarbe/programes/flutter
• Framework revision e6ae95c4ce (il y a 18 heures), 2019-09-11 07:46:57 -0700
• Engine revision 7ea9884ab0
• Dart version 2.5.0 (build 2.5.0-dev.4.0 be66176534)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/rbarbe/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /home/rbarbe/programes/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.3)
• Android Studio at /home/rbarbe/programes/android-studio
• Flutter plugin version 33.3.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] IntelliJ IDEA Community Edition (version 2019.1)
• IntelliJ at /home/rbarbe/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/191.6183.87
• Flutter plugin version 35.2.2
• Dart plugin version 191.6183.88
[✓] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at /home/rbarbe/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/192.6603.28
• Flutter plugin version 39.0.5
• Dart plugin version 192.6603.23
[✓] VS Code (version 1.38.0)
• VS Code at /usr/share/code
• Flutter extension version 3.4.1
[✓] Connected device (1 available)
• CLT L29 • WCR0218315003400 • android-arm64 • Android 9 (API 28)
• No issues found!
您需要 运行 一个 Web 服务器,然后可以在大概 8080 端口使用。如果一切设置正确,您可以:
webdev serve
否则试试:
flutter packages pub global run webdev serve
您是否通过 flutter config --enable-web
启用了网络支持?
Got Reference from this link
还要确保从 master 分支而不是稳定分支升级 flutter
你需要 cd 到你的 flutter 安装工作区,并且 运行:
git checkout master
对于这些chrome
即使在flutter config --enable-web
之后仍然无法检测到的人。你应该检查你的flutter是否在适当的分支,要列出所有分支,使用:
flutter channel
输出可能如下所示:
Flutter channels:
beta
dev
master
* stable
带星号前缀的项目表示你是哪个分支in.To切换到master,试试:
flutter channel master
之后,您的 flutter doctor
可以列出 chrome
设备。
如果您正在尝试使用 dart 开发 web 应用程序,那么我的建议是创建新的 Dart 项目 -> Angular Dart -> 成功创建 angular dart -> 然后打开终端 ->输入 "Webdev serve"
https://flutter.dev/docs/get-started/web
$ flutter channel master
$ flutter upgrade
$ flutter config --enable-web
$ flutter devices //downloads sky_engine and sdk tools then shows a list of devices including chrome
$ flutter create test_app
$ flutter run -d chrome //local host will run chrome
就我而言 - flutter doctor 给了我以下输出
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
与在 arch 上一样,二进制文件称为 google-chrome-stable and/or google-chrome-unstable
export CHROME_EXECUTABLE=/usr/bin/google-chrome-stable
这就是让它正常工作所需的一切。
flutter run -d chrome --web-renderer html
对于 Ubuntu,通过 运行ning
确保您处于主频道
flutter频道大师
然后运行
flutter升级
允许 HTML 网页呈现 运行宁
颤动运行 -d chrome --web-renderer html
自 flutter 1.9 flutter_web 合并到 flutter 中。我正在尝试在 chrome 浏览器中 运行 初始 flutter 应用程序,但它失败了。 OS 是 ubuntu 19.04
我成功使用的命令: 扑动升级
flutter 创建test_1_9
cd test_1_9
颤动运行
命令无效:
颤振运行-dchrome
=> 找不到名称或 ID 匹配 'chrome'
的设备我尝试使用 google-chrome 作为设备名称,结果相同
[✓] Flutter (Channel master, v1.10.2-pre.38, on Linux, locale fr_FR.UTF-8)
• Flutter version 1.10.2-pre.38 at /home/rbarbe/programes/flutter
• Framework revision e6ae95c4ce (il y a 18 heures), 2019-09-11 07:46:57 -0700
• Engine revision 7ea9884ab0
• Dart version 2.5.0 (build 2.5.0-dev.4.0 be66176534)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/rbarbe/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /home/rbarbe/programes/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.3)
• Android Studio at /home/rbarbe/programes/android-studio
• Flutter plugin version 33.3.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] IntelliJ IDEA Community Edition (version 2019.1)
• IntelliJ at /home/rbarbe/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/191.6183.87
• Flutter plugin version 35.2.2
• Dart plugin version 191.6183.88
[✓] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at /home/rbarbe/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/192.6603.28
• Flutter plugin version 39.0.5
• Dart plugin version 192.6603.23
[✓] VS Code (version 1.38.0)
• VS Code at /usr/share/code
• Flutter extension version 3.4.1
[✓] Connected device (1 available)
• CLT L29 • WCR0218315003400 • android-arm64 • Android 9 (API 28)
• No issues found!
您需要 运行 一个 Web 服务器,然后可以在大概 8080 端口使用。如果一切设置正确,您可以:
webdev serve
否则试试:
flutter packages pub global run webdev serve
您是否通过 flutter config --enable-web
启用了网络支持?
Got Reference from this link
还要确保从 master 分支而不是稳定分支升级 flutter
你需要 cd 到你的 flutter 安装工作区,并且 运行:
git checkout master
对于这些chrome
即使在flutter config --enable-web
之后仍然无法检测到的人。你应该检查你的flutter是否在适当的分支,要列出所有分支,使用:
flutter channel
输出可能如下所示:
Flutter channels:
beta
dev
master
* stable
带星号前缀的项目表示你是哪个分支in.To切换到master,试试:
flutter channel master
之后,您的 flutter doctor
可以列出 chrome
设备。
如果您正在尝试使用 dart 开发 web 应用程序,那么我的建议是创建新的 Dart 项目 -> Angular Dart -> 成功创建 angular dart -> 然后打开终端 ->输入 "Webdev serve"
https://flutter.dev/docs/get-started/web
$ flutter channel master
$ flutter upgrade
$ flutter config --enable-web
$ flutter devices //downloads sky_engine and sdk tools then shows a list of devices including chrome
$ flutter create test_app
$ flutter run -d chrome //local host will run chrome
就我而言 - flutter doctor 给了我以下输出
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
与在 arch 上一样,二进制文件称为 google-chrome-stable and/or google-chrome-unstable
export CHROME_EXECUTABLE=/usr/bin/google-chrome-stable
这就是让它正常工作所需的一切。
flutter run -d chrome --web-renderer html
对于 Ubuntu,通过 运行ning
确保您处于主频道flutter频道大师
然后运行
flutter升级
允许 HTML 网页呈现 运行宁
颤动运行 -d chrome --web-renderer html