Emulator field grayed out "not applicable for the main.dart configuration"

Hello,

I have created my first flutter project. I want to run it using the emulator, but it is grayed out. The message “not applicable for the main.dart configuration” appears.
I am running ubuntu 18.04
Here is some output from flutter doctor -v .
[✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Linux, locale en_IL)
• Flutter version 1.9.1+hotfix.2 at /home/r/flutter
• Framework revision 2d2a1ffec9 (3 weeks ago), 2019-09-06 18:39:49 -0700
• Engine revision b863200c37
• Dart version 2.5.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /home/r/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /home/r/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Android Studio (version 3.5)
• Android Studio at /home/r/android-studio
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] Connected device
! No devices available

! Doctor found issues in 1 category.!

1 Like

+1

The same problem on my Mac.

1 Like

The only reason I can think of why it’s happening is that you have not started your emulator.

Had you done that you would not see

[!] Connected device
! No devices available

Message. Please confirm if this is the same issue.

3 Likes

I agree with @ashish173 . First start your emulator and then try to run the Application. Also, make sure that your Flutter Plugin for Android Studio is installed correctly.

My Emulator is Running.

Still grayed out.
Trying to Run “A20 API 29”

image

Same Message.
Latest API 29… Same message with 28…
Flutter Doctor says All okay:
Event Log says Unable to Connect on Port 5037

1 Like

please see my reply.

From github issues comment

The way I fixed it was clicking: File -> Project Structure -> Module
And then add the root folder of the project, then it will detect that its a flutter app again, and then build and work again.

3 Likes

GO TO PROJECT STRUCTURE>PROJECT>NOSDK

Change NOSDK to the latest ANDROID API PLATFORM

THEN GO TO MODULE DO THE SAME

12 Likes

it works for me, tnx

3 Likes

this code work fine
it is very correct

1 Like

What is PROJECT STRUCTURE is missing?

Is it should be like that? (Excluded Folders)

Does not fix mine. What else should i do?

Try checking your dart and flutter sdk configuration in file -> settings -> dart,
file -> settings -> flutter

2 Likes

hey, have you found a solution to it? 'cause I’m facing the same problem!

I have the same problem, I have tried all the solutions and none seem to be working, can one please help me out here ? Flutter Devs ?

@prateekamana Please share your flutter doctor output.

I am also having an issue with this. I am not sure what to do, my flutter doctor says there is a device connected but then it is greyed out. I have tried everything and been working on this for days. Please help.

EDIT: It only runs when I do flutter run from the command line, I can not press the play button in Android Studio ( I think this is a bug in the new update of Android Studio)

1 Like

I am facing the same issue. I tried all the solution above, no one is working for me. I tried flutter doctor, it state there are 2 devices connect (1 is iPhone, 1 is simulator), but the simulator option is still gray and show “not applicable for the main.dart configuration”.

Here’s my flutter doctor result.

For me the Flutter Doctor was showing the same way.

So, I went to Terminal and ran the command flutter upgrade --force.

Then in File-> Settings (Ctrl + Alt + S) I expanded the Languages ​​& Frameworks option and configured the SDK path Dart (C: \ src \ flutter \ bin \ cache \ dart-sdk) and Flutter (C: \ src again) \ flutter) again.

My emulator was already initialized and as soon as I clicked on Apply the option AOSP on IA Emulator (mobile) appeared and the emulator returned to work.

1 Like