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,
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 64 (23 by maintainers)
Commits related to this issue
- Fix race condition in enabling device daemon scanning Fixes #1919 (repeat of #1634). — committed to Dart-Code/Dart-Code by DanTup 5 years ago
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.
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:
flutter devices
and confirm your device show upflutter daemon -v
[{"id":"1","method":"device.enable"}]
into the terminal and press<enter>
(you should see[{"id":"1"}]
printed out)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
C:\Program Files\flutter
drive to any other drive likeF:\Flutter
were I was not asked for administrative permission to do task and then updated the PATH and then I quickly didflutter 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
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
thensudo xcodebuild -runFirstLaunch
It’s only shows create android emulator after updating Xcode 12. It was like Start iOS Simulator option too.
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
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: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
but If I open code from the terminal it works just fine Here’s the output of Flutter: Run Flutter Doctor
and the output of flutter doc -v: (same in both scenarios mentioned above)
@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!