flutter No supported devices connected

最近用到跨平台项目开发(桌面端),需要支持 Windows,Linux,MacOS。研究了目前几种可行的方案,最终选择了 flutter (对比方案包括:C# Xamarin,C++ QT,Java Swing,Flutter,Javascript Electron),一通环境搭建后,终于通过了 flutter doctor,然后再 github 搜索一个demo进行测试和学习,但是真心不容易,本文是解决 flutter run 报

No supported devices connected.
The following devices were found, but are not supported by this project:
Windows (desktop) • windows • windows-x64    • Microsoft Windows [版本 10.0.22000.318]
Chrome (web)      • chrome  • web-javascript • unknown
Edge (web)        • edge    • web-javascript • Microsoft Edge 104.0.1293.47
If you would like your app to run on web or windows, consider running `flutter create .` to generate projects for these platforms.

按照提示,执行create命令

flutter create --platforms=windows,linux,macos 

依然报错

Ambiguous organization in existing files: {xds, dev.marchello}. The --org command line argument must be specified to recreate project.

依据提示,增加 --org 参数

 flutter create --platforms=windows,linux,macos --org=com.sharik.web .

输出

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Recreating project ....
  test\widget_test.dart (created)
  .idea\libraries\KotlinJavaRuntime.xml (created)
  .idea\runConfigurations\main_dart.xml (created)
  macos\.gitignore (created)
  macos\Flutter\Flutter-Debug.xcconfig (created)
  macos\Flutter\Flutter-Release.xcconfig (created)
  macos\Runner\AppDelegate.swift (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\app_icon_1024.png (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\app_icon_128.png (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\app_icon_16.png (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\app_icon_256.png (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\app_icon_32.png (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\app_icon_512.png (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\app_icon_64.png (created)
  macos\Runner\Assets.xcassets\AppIcon.appiconset\Contents.json (created)
  macos\Runner\Base.lproj\MainMenu.xib (created)
  macos\Runner\Configs\AppInfo.xcconfig (created)
  macos\Runner\Configs\Debug.xcconfig (created)
  macos\Runner\Configs\Release.xcconfig (created)
  macos\Runner\Configs\Warnings.xcconfig (created)
  macos\Runner\DebugProfile.entitlements (created)
  macos\Runner\Info.plist (created)
  macos\Runner\MainFlutterWindow.swift (created)
  macos\Runner\Release.entitlements (created)
  macos\Runner.xcodeproj\project.pbxproj (created)
  macos\Runner.xcodeproj\project.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist (created)
  macos\Runner.xcodeproj\xcshareddata\xcschemes\Runner.xcscheme (created)
  macos\Runner.xcworkspace\contents.xcworkspacedata (created)
  macos\Runner.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist (created)
  sharik.iml (created)
  windows\.gitignore (created)
  windows\CMakeLists.txt (created)
  windows\flutter\CMakeLists.txt (created)
  windows\runner\CMakeLists.txt (created)
  windows\runner\flutter_window.cpp (created)
  windows\runner\flutter_window.h (created)
  windows\runner\main.cpp (created)
  windows\runner\resource.h (created)
  windows\runner\resources\app_icon.ico (created)
  windows\runner\runner.exe.manifest (created)
  windows\runner\Runner.rc (created)
  windows\runner\utils.cpp (created)
  windows\runner\utils.h (created)
  windows\runner\win32_window.cpp (created)
  windows\runner\win32_window.h (created)
Running "flutter pub get" in sharik...                             26.3s
Wrote 45 files.

All done!
In order to run your application, type:

  $ cd .
  $ flutter run

Your application code is in .\lib\main.dart.


解决!!!

# flutter  

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×