不适用于"main.dart"设备的设备.配置 , [英] Device not applicable for the "main.dart" configuration ,
问题描述
我在编码Flutter时使用Android Studio作为我的IDE.在此之前,我已经可以创建2个项目,并且效果很好.我不得不从Github复制一个仓库. IDE说要获取配置.我做到了,然后这件事发生了.
I use Android Studio as my IDE in coding Flutter. I was able to create 2 projects before this and it worked absolutely fine. I had to clone a repo from Github. The IDE said to get config. I did that then this happened.
我已经安装了sdk.
我的android设备android版本是7.0
My android devices android version is 7.0
Flutter Doctor结果:
Flutter Doctor result:
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
• Flutter version 1.12.13+hotfix.8 at C:\src\flutter\flutter
• Framework revision 0b8abb4724 (6 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[!] Android Studio
• Android Studio at C:\Program
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
X android-studio-dir = C:\Program
X Android Studio not found at C:\Program
• Try updating or re-installing Android Studio.
• Consider removing your android-studio-dir setting by running:
flutter config --android-studio-dir=
[!] VS Code
• VS Code at C:\Users\Tamim Mostafa\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
我还尝试过在没有空格的using文件夹下更改目录.我将Sdk文件夹移到了D:\ Android \ Sdk.扑医生-v:
I also tried changing the directory an using folder with no white space. I moved the Sdk folder to D:\Android\Sdk. flutter doctor -v:
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
• Flutter version 1.12.13+hotfix.8 at C:\src\flutter\flutter
• Framework revision 0b8abb4724 (6 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[X] Android toolchain - develop for Android devices
X ANDROID_HOME = D:\Android\Sdk
but Android SDK not found at this location.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[!] Android Studio
• Android Studio at C:\Program
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
X android-studio-dir = C:\Program
X Android Studio not found at C:\Program
• Try updating or re-installing Android Studio.
• Consider removing your android-studio-dir setting by running:
flutter config --android-studio-dir=
[!] VS Code
• VS Code at C:\Users\Tamim Mostafa\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
推荐答案
这似乎是问题所在:
[X] Android toolchain - develop for Android devices
-> ANDROID_HOME = D:\Android\Sdk but Android SDK not found at this location.
由于您说过将Android SDK添加到了D目录,因此只需将D:\Android\sdk\tools
和D:\Android\sdk\platform-tools
添加到PATH环境变量中即可.这是将其添加到Path环境变量中的方法: https://docs.telerik.com/teststudio/features/test-runners/add-path-environment-variables
Since you said that you added the Android SDK to your D directory, you could just add D:\Android\sdk\tools
and D:\Android\sdk\platform-tools
to your PATH environment variable. This is how you can add it to your Path enviroment variable: https://docs.telerik.com/teststudio/features/test-runners/add-path-environment-variables
这篇关于不适用于"main.dart"设备的设备.配置 ,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!