简体   繁体   English

Flutter-直接从Android Studio运行/调试桌面应用[配置]

[英]Flutter - run/debug desktop app directly from Android Studio [configuration]

I want to conveniently develop Desktop applications using Flutter & Android Studio . 我想使用FlutterAndroid Studio方便地开发桌面应用程序。 Currently Flutter Desktop Apps run only on the master channel. 目前,Flutter桌面应用程序仅在master渠道上运行。

I'm able to flawlessly enable MacOS as a flutter device with export ENABLE_FLUTTER_DESKTOP=true where my macos laptop shows as the following device: 我可以通过export ENABLE_FLUTTER_DESKTOP=true完美地将MacOS启用为export ENABLE_FLUTTER_DESKTOP=true设备,其中macOS笔记本电脑显示为以下设备:

$ flutter devices
1 connected device:

macOS • macOS • darwin-x64 • Mac OS X 10.14.5 18F132

I can launch the app directly on desktop with flutter run 我可以通过flutter run在桌面上直接启动该应用程序

Which Run/Debug configuration should I choose to automatically build & launch Flutter app from Android Studio? 我应该选择哪种运行/调试配置来从Android Studio自动构建和启动Flutter应用程序?

Flutter ver. 颤动版 Channel master, v1.9.8-pre.108 频道主播,v1.9.8-pre.108

EDIT: as @smorgan correctly suggested, just run: flutter config --enable-macos-desktop 编辑:按照@smorgan正确建议,只需运行: flutter config --enable-macos-desktop

在此处输入图片说明 Remember that you also need to have macos build target in your app workspace: 请记住,您还需要在应用程序工作区中建立macos构建目标:

在此处输入图片说明

You should not use ENABLE_FLUTTER_DESKTOP ; 您不应使用ENABLE_FLUTTER_DESKTOP ; any instructions referencing it are out of date. 任何引用它的说明都已过时。 You should instead run flutter config --enable-macos-desktop as described in the official documentation . 您应该按照官方文档中的说明运行flutter config --enable-macos-desktop

That approach will enable desktop support everywhere, including Android Studio, rather than just the current terminal. 这种方法将使包括Android Studio在内的所有地方都支持桌面,而不仅仅是当前的终端。 Once you do that, normal Flutter workflows in Android Studio will work for desktop. 完成此操作后,Android Studio中的常规Flutter工作流程将适用于台式机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM