【问题标题】:Device not applicable for the “main.dart” configuration设备不适用于“main.dart”配置
【发布时间】:2020-05-05 12:26:12
【问题描述】:

在有人将我指向 this link 之前,我想提一下,我认为这些没有直接关系。

可以看到我的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 的热重载功能似乎无法正常工作。

我已经按照here 的建议将主文件夹添加到项目中,并且我还确保按照同一链接中的建议将NO SDK 更改为ANDROID API PLATFORMProject Structure > Modules 中的所有依赖项都由 Android Studio 找到。我从GitHub 上的稳定分支克隆了 Flutter SKD。

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

【问题讨论】:

  • 不,遗憾的是没有。我实际上在我的问题的第一句话中链接了这个问题。我已经尝试了几乎所有在 stackoverflow 上找到的东西。 flutter doctor 也不会返回如上所示的错误。工具链似乎不是问题。

标签: android android-studio flutter android-emulator


【解决方案1】:

关闭 Android Studio 并再次以管理员身份运行

【讨论】:

    【解决方案2】:

    它解决了我的问题:

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

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

    【讨论】:

      【解决方案3】:

      我以前也有同样的问题。

      • 从 Android Studio 中卸载 Flutter 和 Dart 插件,然后重新安装 Flutter(Dart 会自动安装)
      • 从 AVD Manager 中删除创建的模拟器并创建新的模拟器
      • 尝试制作新项目,并在“文件”>“项目结构”中将 SDK 版本设置为与模拟器 API 版本相同或更低...

      希望对你有用。

      【讨论】:

        猜你喜欢
        • 2020-07-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-08-26
        • 1970-01-01
        • 1970-01-01
        • 2015-05-10
        • 2012-10-05
        相关资源
        最近更新 更多