3

I am able to run my Flutter project in an emulator in Android Studio. I'm trying to run that same code in debug mode (f5) in VS Code, but I get an error saying:

Set the 'program' value in your launch config (eg 'lib/main.dart') then launch again.

So I updated my launch config to the following:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Dart & Flutter",
            "request": "launch",
            "type": "dart",
            "program": "lib/main.dart"
        }
    ]
}

After that update, when I try f5 I get the following error:

Your launch config references a program that does not exist. If you have problems launching, check the "program" field in your ".vscode/launch.json" file.

I DO have a main.dart file??

Any help would be greatly appreciated.

3 Answers 3

9

instead of "program": "lib/main.dart" try "flutterMode": "debug"

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Dart & Flutter",
            "request": "launch",
            "type": "dart",
            "flutterMode": "debug"
        }
    ]
}
Sign up to request clarification or add additional context in comments.

2 Comments

unfortunately, I'm still getting the same messages.
I'm not sure if this helps, but I am able to run the app by going to the terminal and typing flutter run. Not sure why it can find the main.dart file that way, but not using f5 debug mode?
2

For some reason, VS Code was using the launch config from a different project folder that was in my workspace. After removing that project, f5 worked as expected.

Comments

1

flutter run would help, In my case first run flutter doctor , later do resolve missing configs as mentioned and then Flutter run

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.