skip to Main Content

I installed Flutter and VS Code in the following way:

$ sudo snap install --classic code
$ sudo snap install --classic flutter 
$ tail -n 1 ~/.bashrc
export CHROME_EXECUTABLE="/usr/bin/chromium"
$ flutter doctor -v
[✓] Flutter (Channel stable, 2.2.1, on Linux, locale en_AU.UTF-8)
    • Flutter version 2.2.1 at /home/debian/snap/flutter/common/flutter
    • Framework revision 02c026b03c (4 months ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[✗] Android toolchain - develop for Android devices
    ✗ 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/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/chromium

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Chromium 90.0.4430.212 built on Debian 11.0, running on Debian 11.0

! Doctor found issues in 2 categories.

I can start the Flutter app in terminal.

enter image description here

However, under VS code I get Unable to connect to Chrome debug port: 37095

enter image description here

What did I miss?

4

Answers


  1. Chosen as BEST ANSWER

    The solution is that chromium, flutter and VS code have to be installed through SNAP.


  2. If you work behind a proxy, you should set env no_proxy=localhost,127.0.0.1.
    But if you are not using any proxy, try to install Dart Chrome Extension.

    Login or Signup to reply.
  3. Try running flutter clean and then flutter create .

    If that didn’t worked out delete your launch.json in your .vscode directory and then run your app, this issue occurs if there are any misconfiguration in launch.json file in vscode. and make sure your port is empty and not used by any other program such Microsoft IIS services or MySQL…

    to make vscode CTRL+F5 run in chrome or web-server go to your project root directory create .vscode directory and inside that folder add launch.json file.

    Now if you want to run in web server only from vscode debugger then add this lines in you launch.json

    {
     "version": "0.2.0",
     "configurations": [{
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "args": ["-d", "web-server","--web-port", "8000"],
        }
    ]}
    

    And if you want to launch in chrome device change argument web-server to chome i.e.

    {   
     "version": "0.2.0",
     "configurations": [{
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "args": ["-d", "chrome","--web-port", "8000"],
        }
    ]}
    

    Now run CTRL+F5

    If you don’t have problem in changing your port then try running your program from terminal with flutter run -d chrome --web-port XXXXX

    here XXXXX represents your port number.

    Login or Signup to reply.
  4. in my case;

    i was set the localhost to a local ip on hosts file of the OS for remote development and forget it. that’s why flutter run -d chrome gave the feedback connection refused.

    solution:

    in OSX, edit the hosts file located at /private/etc/hosts path and ensure localhost paired with 127.0.0.1

    that’s all.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search