question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't launch Flutter app from a multi-root workspace with a launch configuration

See original GitHub issue

Environment

Flutter: 0.5.1 Beta Channel MacOS: 10.13.5 Visual Studio Code: 1.25 Dart Code: 2.15

Steps to Repro

  1. Create a new plugin project:
flutter create -t plugin myplugin
  1. Create a multi-root workspace file in the new project
{
    "folders": [
        {
            "path": "example",
            "name": "Example"
        },
        {
            "path": ".",
            "name": "Root"
        }
    ],
    "settings": {},
    "launch": {
        "configurations": [
            {
                "name": "Example Debug",
                "program": "/${workspaceFolder:Example}/lib/main.dart",
                "request": "launch",
                "type": "dart",
                "flutterMode": "debug"
            }
        ],
        "compounds": []
    }
}
  1. Save As… the file as myplugin.code-workspace in the myplugin directory.

  2. Open the myplugin workspace in VS Code using Open Workspace…

  3. Press F5 to Start Debugging…

Actual Results:

The Debug controls window appears, the Status bar turns orange, and the Debug Console is displayed. Wait as long you like but no messages appear in the Debug Console and the app will never launch.

Expected Results:

The app launches into debug mode.

Logs:

There was no significant log output while the app was attempting to launch.

Dart Code extension: 2.15.0
Flutter extension: 2.15.0
Platform: mac
Workspace type: Flutter
Multi-root?: true
Dart SDK:
    Loc: /Users/tony/afero/flutter/bin/cache/dart-sdk
    Ver: 2.0.0-edge.c080951d45e79cd25df98036c4be835b284a269c
Flutter SDK:
    Loc: /Users/tony/afero/flutter
    Ver: 0.5.1

Wed Jul 11 2018 [12:44:11 GMT-0700 (PDT)] Log file started
Wed Jul 11 2018 [12:53:33 GMT-0700 (PDT)] Log file ended

Flutter Doctor

[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale en-US)
    • Flutter version 0.5.1 at /Users/tony/afero/flutter
    • Framework revision c7ea3ca377 (6 weeks ago), 2018-05-29 21:07:33 +0200
    • Engine revision 1ed25ca7b7
    • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/tony/Library/Android/sdk
    • Android NDK at /Users/tony/Library/Android/sdk/ndk-bundle
    • Platform android-27, build-tools 27.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_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4.1, Build version 9F2000
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 26.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] VS Code (version 1.25.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.14.0

[✓] Connected devices (2 available)
    • Ranger   • [REDACTED] • ios • iOS 11.4.1
    • iPhone X • 93ED801E-E0FB-4B97-8F7D-AB12185BEA9E     • ios • iOS 11.4 (simulator)

• No issues found!

Not sure why Flutter Doctor is reporting VS Code Flutter Extension v2.14. VS Code report v2.15. Here’s a screenshot of my installed extensions: image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
c-cptcommented, Aug 21, 2019

This worked for me.
{ “name”: “App-Name-Flutter”, “request”: “launch”, “type”: “dart”, “program”: “${workspaceFolder}/packages/name-app/lib/main.dart” }

1reaction
kibantonycommented, Jul 12, 2018

Here’s something interesting. I changed the path to:

     "program": "./example/lib/main.dart",

Pressed F5, and I get this error dialog: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspace with multiple Dart / Flutter projects, how to tell ...
You can control this by creating a Launch Configuration (see ... Another option is to use VS Code's "Multi-Root Workspaces", where you'll be ......
Read more >
Setup Visual Studio Code's Network Connection
The CLI interface is what you get when running code --install-extension vscodevim.vim from a command prompt or terminal. You can follow this issue's...
Read more >
v3.52 - Dart Code - Dart & Flutter support for Visual Studio Code
#4197: When launching debug sessions, if an explicit program is supplied but no cwd in the launch configuration, only the program (and not...
Read more >
Expert Flutter IDE SetUp - Medium
an opinionated way to set-up an IDE for Flutter app development to get more power! No matter you want to use the Android...
Read more >
failed to launch flutter emulator: error: emulator didn't connect ...
I try run flutter emulator on Visual Code Studio but cannot launch. ... Code: 1.36.1 Platform: win Workspace type: Flutter Multi-root?: false Dart...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found