设备不适用于“ main.dart”配置

时间:2020-05-05 12:26:12

标签: android android-studio flutter android-emulator

在任何人将我指向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,如下所示:

grayed out android device

我现在只能像这样使用下拉菜单<no device>启动仿真器:

adding android device

有趣的是,我实际上可以在设备上显示我的应用程序,而设备仍显示为灰色:

running emulator

颤振热重装功能似乎无法正常工作。

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

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

3 个答案:

答案 0 :(得分:1)

它解决了我的问题:

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

2- 从 File > setting > Language & Framework > flutter 中选择 flutter SDK 路径。 just do like this

答案 1 :(得分:0)

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

答案 2 :(得分:-1)

我以前有同样的问题。

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

希望为您服务。

相关问题