点击运行按钮,android studio 提示No connected devices found; please connect a device, or see flutter.dev/setup for getting started instructions.,如下图:

在这里插入图片描述
解决:
执行flutter emulators

$ flutter emulators
6 available emulators:

4_WVGA_Nexus_S_API_30          • 4  WVGA (Nexus S) API 30       • Generic • android
Device_5.8_1440_2960_API_30    • Device 5.8 1440 2960 API 30    • User    • android
Device_5inch_1440_2560_API_30  • Device 5inch 1440 2560 API 30  • User    • android
Pixel_3a_API_30_x86            • Pixel_3a_API_30_x86            • Google  • android
Pixel_XL_API_30                • Pixel XL API 30                • Google  • android
Pixel_XL_API_30_720_1280_5inch • Pixel XL API 30 720_1280_5inch • User    • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager

按照提示执行flutter emulators --launch Pixel_XL_API_30 启动了模拟器,但还是提示No connected devices found; please connect a device, or see flutter.dev/setup for getting started instructions.

打开 lib/main.dart 文件,Android Studio会弹出 enable dart sdk 的提示框,点击后,模拟器可以正常使用了:

在这里插入图片描述
可以看到 sdk gphone x86 arm 这个模拟器是高亮的,可以正常使用。

另外,如果有时候出现Run按钮是灰色的情况,可以点击File -setting ,然后进入这个页面:
在这里插入图片描述

先取消勾选Enable Dart,点击OK,然后再次勾选Enable Dart

总结:
方式1:关闭模拟器,重启模拟器
方式2:上面说的方式,先取消勾选Enable Dart,然后再次勾选Enable Dart
方式2:重启as试试

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐