Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

android - Device not applicable for the "main.dart" configuration ,

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. enter image description here

I already installed sdk .

My android devices android version is 7.0 my android devices android version is 7.0

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:srcflutterflutter
    ? 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 FilesAndroidAndroid 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:UsersTamim MostafaAppDataLocalProgramsMicrosoft 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.

I also tried changing the directory an using folder with no white space. I moved the Sdk folder to D:AndroidSdk. 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:srcflutterflutter
    ? 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:AndroidSdk
      but Android SDK not found at this location.

[√] Android Studio (version 3.6)
    ? Android Studio at C:Program FilesAndroidAndroid 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:UsersTamim MostafaAppDataLocalProgramsMicrosoft 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.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It solved my problem:

  1. Make sure Flutter plugin is installed in android studio, you can install the plugin from file > setting > plugin
  2. choose flutter SDK path from File > setting> Language & Framework > flutter.

For my case the flutter sdk path was D:/flutter


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...