简体   繁体   English

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

[英]Device not applicable for the “main.dart” configuration

Before anyone points me to this link I would like to mention, that I don't think these are directly related.在有人向我指出此链接之前,我想提一下,我认为这些没有直接关系。

As one can see my flutter doctor -v command is error free:可以看到我的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!

Yet I to have the issue of a grayed out emulator device with the message Device not applicable for the “main.dart” configuration like this:然而,我遇到了一个灰色的仿真器设备问题,消息Device not applicable for the “main.dart” configuration ,如下所示:

灰色的安卓设备

I can now only start the emulator using the dropdown menu <no device> like this:我现在只能使用下拉菜单<no device>启动模拟器,如下所示:

添加安卓设备

Interestingly I am then actually able to run my app on the device, while the device is still grayed out:有趣的是,我实际上能够在设备上运行我的应用程序,而设备仍然是灰色的:

运行模拟器

Flutters hot-reloading feature seems to not work properly though.不过,Flutters 的热重载功能似乎无法正常工作。

I have already added the main folder to the project as suggested here and I also made sure to change NO SDK to ANDROID API PLATFORM as suggested in the same link.我已经按照此处的建议将主文件夹添加到项目中,并且我还确保按照同一链接中的建议将NO SDK更改为ANDROID API PLATFORM All dependencies in Project Structure > Modules are found by Android Studio. Project Structure > Modules中的所有依赖项均由 Android Studio 找到。 I cloned the Flutter SKD from the stable branch on GitHub .我从 GitHub 上的稳定分支克隆了Flutter SKD。

Does anyone have an idea why my setup is behaving this way?有谁知道为什么我的设置会这样?

It solved my problem:它解决了我的问题:

1- Make sure Flutter plugin is installed in android studio, you can install the plugin from file > setting > plugin 1-确保Flutter插件安装在android studio中,您可以从文件>设置>插件安装插件

2- choose flutter SDK path from File > setting> Language & Framework > flutter. 2- 从文件 > 设置 > 语言和框架 > flutter 中选择 flutter SDK 路径。 就这样做

Close Android Studio and Run again as Administrator关闭Android Studio并再次以管理员身份运行

I have the same issue before.我以前也有同样的问题。

  • Uninstall Flutter and Dart plugin from Android Studio then reinstall Flutter (Dart will be installed automatically)从 Android Studio 中卸载 Flutter 和 Dart 插件,然后重新安装 ZC047B10EEE763AFB6164E077CF1(将自动安装)
  • Remove created emulators from AVD Manager and create new one从 AVD Manager 中删除创建的模拟器并创建新的
  • Try making new project, and set SDK version same as emulators API version or lower from File > Project Structure...尝试制作新项目,并从文件 > 项目结构...

Hopefully worked for you.希望对你有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 设备不适用于“main.dart”配置, - Device not applicable for the "main.dart" configuration , 无法在 ARM Mac 上的 IntelliJ 中的 Android 模拟器上运行 Flutter 项目,说该模拟器不适用于“main.dart”配置 - Cannot run Flutter project on Android emulator in IntelliJ on ARM Mac, says that the emulator is not applicable for the "main.dart" configuration main.dart中的脚手架未编译 - Scaffold in main.dart not compiling 在 FCM onLaunch 上防止 main.dart - Prevent main.dart on FCM onLaunch Flutter:如何打开main.dart - Flutter: How to open main.dart Flutter 返回 Main.dart 屏幕而不是关闭应用程序 - Flutter returns Main.dart screen instead of closing the Application 如何在 flutter 中的 main.dart 中实现多个包? - How to implement multiple packages in main.dart in flutter? Android Studio 替换了我 main.dart 文件中的代码 - Android Studio replaced code in my main.dart file Flutter 的 main.dart 文件在 Android Studio 中执行时卡在“Syncing files to device Android SDK built for x86 64...” - Flutter's main.dart file gets stuck at "Syncing files to device Android SDK built for x86 64..." at execution in Android Studio 完成动画时如何将小部件和该小部件的功能传递给 main.dart? - How to Pass Widget and Functions of That Widget To main.dart When Completing an Animation?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM