首页 > 解决方案 > 设备不适用于“main.dart”配置

问题描述

在有人向我指出此链接之前,我想提一下,我认为这些没有直接关系。

可以看到我的flutter doctor -v命令没有错误:

➜  flutter git:(stable) flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.3 19D76, locale en-US)
    • Flutter version 1.12.13+hotfix.9 at /Users/johannes/.flutter-cli/flutter
    • Framework revision f139b11009 (5 weeks ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/johannes/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

然而,我遇到了灰色仿真器设备的问题,消息Device not applicable for the “main.dart” configuration如下:

灰色的安卓设备

我现在只能使用这样的下拉菜单启动模拟器<no device>

添加安卓设备

有趣的是,我实际上能够在设备上运行我的应用程序,而设备仍然是灰色的:

运行模拟器

不过,Flutters 的热重载功能似乎无法正常工作。

我已经按照此处的建议将主文件夹添加到项目中,并且我还确保按照同一链接中的建议NO SDK进行更改。Android Studio 可以找到其中的ANDROID API PLATFORM所有依赖项。我从GitHub 上Project Structure > Modules的 stable 分支克隆了 Flutter SKD 。

有谁知道为什么我的设置会这样?

标签: androidandroid-studioflutterandroid-emulator

解决方案


它解决了我的问题:

1-确保在android studio中安装了Flutter插件,您可以从文件>设置>插件安装插件

2-从文件>设置>语言和框架>颤振中选择颤振SDK路径。 就这样做


推荐阅读