Dart-Code: Device not showing up in VSCode, but detected in flutter

I am trying to debug my project with a real Android device (Mi Mix 2S running Android 9.0).

It works fine when running flutter run, but I cannot find the device in VSCode.

C:\Users\cheng>flutter doctor -v
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.18362.53], locale zh-CN)
    • Flutter version 1.2.1 at C:\Users\cheng\Documents\Software\flutter
    • Framework revision 8661d8aecd (9 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\cheng\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Users\cheng\Documents\Software\android-studio-preview\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.3)
    • Android Studio at C:\Users\cheng\Documents\Software\android-studio-preview
    • Flutter plugin version 32.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] VS Code (version 1.33.1)
    • VS Code at C:\Users\cheng\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 2.25.1

[√] Connected device (1 available)
    • MIX 2S • 9723ff13 • android-arm64 • Android 9 (API 28)

• No issues found!

However, image

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 64 (23 by maintainers)

Commits related to this issue

Most upvoted comments

Workaround: I had this issue as well with an iOS device. By disabling and re-enabling the Flutter plugin in VS Code, the issue was gone.

I can’t find “No devices” in my status bar, only Flutter version is there.

Make sure you’ve got a .dart file open, and if it still doesn’t appear, please attach a screenshot.

It seems like there may be a big in Flutter here though, but just to get some more info, can you do this:

  • Run flutter devices and confirm your device show up
  • Run flutter daemon -v
  • Once the daemon says it’s connected, paste [{"id":"1","method":"device.enable"}] into the terminal and press <enter> (you should see [{"id":"1"}] printed out)
  • Disconnect your device
  • Wait 10 seconds
  • Reconnected your device

Then paste the full output of all of that here.

Thanks!

just restart the VScode and that’s it.

On your device go to developer option–> Revoke USB debugging and disconnect your device you will get a RSA fingerprint verification window click on accept .Done

@chengyuhui Can you try running the Flutter: Run Flutter Doctor command from the VS Code command palette to see whether that shows the device? This may give different results to running it from the built-in terminal since it won’t run any terminal startup scripts.

Worked after restarting my mac.

Happened when my pc shutdown instantly due to a power issue, then I turned on the pc, this error happend. I tried the following steps

  1. Disabled and Enabled Flutter plugin,
  2. Disabled and Enabled Dart plugin
  3. Restarted vscode
  4. Restarted PC Nothing worked, And then I opened another flutter project folder from VSCODE>FILE>OPEN It started showing up.

vscode I was facing the same issue so this is what I did… I changed the location of Flutter SDK from C:\Program Files\flutter drive to any other drive like F:\Flutter were I was not asked for administrative permission to do task and then updated the PATH and then I quickly did flutter doctor check and it was all good and created new Flutter project from cmd and device was detected and I was able to launch emulator from the VScode directly and I was facing same issue in Android Studio this was the fix for both in my case hope it works for you.

SOLUCION

go into this route and delete this all inside Code: remember to enable hidden folders image

Open visual studio and everything will be correct, just in case they install flutter extension again. Ready

I had to run sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer then sudo xcodebuild -runFirstLaunch

It’s only shows create android emulator after updating Xcode 12. It was like Start iOS Simulator option too. image

I had the same issue but on one project when the other projects were working fine somehow, So when I deleted the project and re-cloned it worked. ^_^

This issue is caused by an extension. This was how I solved my mine just search for the extension uninstall or disable it. Restart your vscode again. Happy coding

@rajput-hemant

when I’m opening code from the app drawer or shortcut, devices don’t show up in the bottom bar

If it works when starting Code from the terminal, it’s likely that you’ve got some environment variables (such as Android SDK or Java ones) set in a way that only applies to terminals and their sub-processes (such as in a terminal startup script).

You’ll need to either set them somewhere that applies to all processes (not just terminals and their sub-processes), or set them in the dart.env setting so they will be explicitly added by Dart-Code to all spawned processes:

{
  "dart.env": {
    "ANDROID_HOME": "/home/rajput-hemant/android",
    "CHROME_EXECUTABLE": "/usr/bin/microsoft-edge-stable"
  }
}

See https://github.com/Dart-Code/Dart-Code/issues/2124 for additional notes about the same sort of issue.

My device is not detected today, it was detected before, checking developer option is on, but found usb debugging is off somehow, set it on and everything is okay

After some searching and playing around with proxy settings (I am in China so I have proxy enabled for some plugins to work), everything works perfectly now.

Anyway, thanks for your help!

@DanTup I added the envs in dart.env and now it’s working as expected. Thanks 😊

I’m facing the same issue when I’m opening code from the app drawer or shortcut, devices don’t show up in the bottom bar Here’s the output of Flutter: Run Flutter Doctor

[flutter] flutter doctor -v
[✓] Flutter (Channel stable, 3.0.4, on EndeavourOS 5.18.16-arch1-1, locale en_AG)
    • Flutter version 3.0.4 at /home/rajput-hemant/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (5 weeks ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✗] 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 (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 14.0.6
    • cmake version 3.23.3
    • ninja version 1.11.0
    • pkg-config version 1.8.0

[!] 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)
    • Linux (desktop) • linux • linux-x64 • EndeavourOS 5.18.16-arch1-1

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 3 categories.
exit code 0

but If I open code from the terminal it works just fine Here’s the output of Flutter: Run Flutter Doctor

[flutter] flutter doctor -v
[✓] Flutter (Channel stable, 3.0.4, on EndeavourOS 5.18.16-arch1-1, locale en_AG)
    • Flutter version 3.0.4 at /home/rajput-hemant/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (5 weeks ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/rajput-hemant/android
    • Platform android-31, build-tools 30.0.3
    • ANDROID_HOME = /home/rajput-hemant/android
    • Java binary at: /usr/bin/java
    • Java version Java(TM) SE Runtime Environment (build 18.0.2+9-61)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/microsoft-edge-stable

[✓] Linux toolchain - develop for Linux desktop
    • clang version 14.0.6
    • cmake version 3.23.3
    • ninja version 1.11.0
    • pkg-config version 1.8.0

[!] 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 (3 available)
    • RMX1801 (mobile) • 86fbaad7 • android-arm64  • Android 10 (API 29)
    • Linux (desktop)  • linux    • linux-x64      • EndeavourOS 5.18.16-arch1-1
    • Chrome (web)     • chrome   • web-javascript • Microsoft Edge 103.0.1264.77

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
exit code 0

and the output of flutter doc -v: (same in both scenarios mentioned above)

❯ fldoc -v
[✓] Flutter (Channel stable, 3.0.4, on EndeavourOS 5.18.16-arch1-1, locale en_GB.UTF-8)
    • Flutter version 3.0.4 at /home/rajput-hemant/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (5 weeks ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/rajput-hemant/android
    • Platform android-31, build-tools 30.0.3
    • ANDROID_HOME = /home/rajput-hemant/android
    • Java binary at: /usr/bin/java
    • Java version Java(TM) SE Runtime Environment (build 18.0.2+9-61)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/microsoft-edge-stable

[✓] Linux toolchain - develop for Linux desktop
    • clang version 14.0.6
    • cmake version 3.23.3
    • ninja version 1.11.0
    • pkg-config version 1.8.0

[!] 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 (3 available)
    • RMX1801 (mobile) • 86fbaad7 • android-arm64  • Android 10 (API 29)
    • Linux (desktop)  • linux    • linux-x64      • EndeavourOS 5.18.16-arch1-1
    • Chrome (web)     • chrome   • web-javascript • Microsoft Edge 103.0.1264.77

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

@Sidhi28 please file a new issue, and include the full output of running flutter doctor -v in the terminal, and also running the Flutter: Run Flutter Doctor command from the VS Code command palette. Thanks!

@jamie1192 please can you capture a daemon log (https://dartcode.org/docs/logging/#flutter-daemon) when this happens and attach it to a new issue? Thanks!