Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device not showing up in VSCode, but detected in flutter #1634

Closed
chengyuhui opened this issue Apr 19, 2019 · 64 comments
Closed

Device not showing up in VSCode, but detected in flutter #1634

chengyuhui opened this issue Apr 19, 2019 · 64 comments
Labels
in flutter Relates to running Flutter apps is bug
Milestone

Comments

@chengyuhui
Copy link

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

@DanTup
Copy link
Member

DanTup commented Apr 19, 2019

@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.

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Apr 19, 2019
@chengyuhui
Copy link
Author

The flutter doctor output shown in the given screenshot is triggered by Flutter: Run Flutter Doctor command. As is shown, the device shows up here (PS: I don't have any emulator on this computer).

@DanTup
Copy link
Member

DanTup commented Apr 20, 2019

Oh, sorry - I thought that was your terminal! Do you also see "No devices" in the status bar (bottom right)?

Can you check whether an errors are listed in the VS Code dev console (Help -> Toggle Developer Tools), and also use the dart.flutterDaemonLogFile setting to capture a daemon log file. After setting the setting, restart VS Code, then disconnect/reconnect your device, and then grab a copy of the logs, and we can see if there's anything obvious in there.

Thanks!

@DanTup DanTup added in flutter Relates to running Flutter apps is bug labels Apr 20, 2019
@chengyuhui
Copy link
Author

Daemon Log:

!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 2.25.1
Flutter extension: 2.25.1 (not activated)
VS Code: 1.33.1
Platform: win
Workspace type: Flutter
Multi-root?: false
Dart SDK:
    Loc: C:\Users\cheng\Documents\Software\flutter\bin\cache\dart-sdk
    Ver: 2.2.0-edge.0a7dcf17eb5f2450480527d6ad1e201fb47f1e36
Flutter SDK:
    Loc: C:\Users\cheng\Documents\Software\flutter
    Ver: 1.2.1
HTTP_PROXY: undefined
NO_PROXY: undefined

[下午3:50:22]: Spawning C:\Users\cheng\Documents\Software\flutter\bin\flutter.bat with args ["daemon"]
[下午3:50:22]: ..  in C:\Users\cheng\Documents\Software\flutter
[下午3:50:22]: PID: 20864
[下午3:50:22]: ==> [{"id":"1","method":"device.enable"}]
[下午3:50:30]: <== Starting device daemon...
[下午3:50:30]: <== [{"event":"daemon.connected","params":{"version":"0.4.2","pid":2312}}]
[下午3:51:00]: ==> [{"id":"2","method":"emulator.getEmulators"}]
[下午3:51:01]: <== [{"id":"2","result":[]}]

Nothing happens when the device is disconnected/reconnected, nothing related to flutter/dart in DevTools console.
I can't find "No devices" in my status bar, only Flutter version is there.

@DanTup
Copy link
Member

DanTup commented Apr 20, 2019

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!

@chengyuhui
Copy link
Author

chengyuhui commented Apr 20, 2019

It is really not here:
image
(Logs on the right are from a manual flutter run)
Output:

C:\Users\cheng>flutter devices
1 connected device:

MIX 2S • 9723ff13 • android-arm64 • Android 9 (API 28)

C:\Users\cheng>flutter daemon -v
[  +13 ms] executing: [C:\Users\cheng\Documents\Software\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +474 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +2 ms] origin/stable
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git rev-parse --abbrev-ref HEAD
[ +459 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +1 ms] stable
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git ls-remote --get-url origin
[ +455 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git log -n 1 --pretty=format:%H
[ +463 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +1 ms] 8661d8aecd626f7f57ccbcb735553edc05a2e713
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git log -n 1 --pretty=format:%ar
[ +462 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[   +1 ms] 9 weeks ago
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +462 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[   +1 ms] v1.2.1-0-g8661d8aec
[ +549 ms] Starting device daemon...
[{"event":"daemon.connected","params":{"version":"0.4.2","pid":21800}}]
[{"id":"1","method":"device.enable"}]
[{"id":"1"}]
[{"event":"device.added","params":{"id":"9723ff13","name":"MIX 2S","platform":"android-arm64","emulator":false}}]
[{"event":"daemon.logMessage","params":{"level":"error","message":"Error retrieving device properties for ro.product.cpu.abi:"}}]
[{"event":"daemon.logMessage","params":{"level":"error","message":"error: device '9723ff13' not found\r\n"}}]
[{"event":"device.removed","params":{"id":"9723ff13","name":"MIX 2S","platform":"android-arm","emulator":false}}]
[{"event":"device.added","params":{"id":"9723ff13","name":"MIX 2S","platform":"android-arm64","emulator":false}}]

@DanTup
Copy link
Member

DanTup commented Apr 20, 2019

That's very strange - it should be added to the status bar when it detects a device. It's also strange that this new log shows the device connecting/disconnecting. Though it does have an error:

Error retrieving device properties for ro.product.cpu.abi:

Does this appear immediately when you connect the device, or only when you disconnected it?

Also, can you check the dev tools (Help -> Toggle Developer Tools) in VS Code to see if there are any warnings or errors?

@chengyuhui
Copy link
Author

chengyuhui commented Apr 21, 2019

Those errors only show up after the cable is unplugged, so I don't think they are related to this case.

Again, there is no Flutter-related logs in my DevTools console.

Actually I noticed a difference (don't know if it matters).

In the log output from the extension, [{"id":"1","method":"device.enable"}] comes before Starting device daemon..., but you asked me to sent that command after the daemon is connected, perhaps a timing issue?

@DanTup
Copy link
Member

DanTup commented Apr 22, 2019

In the log output from the extension, [{"id":"1","method":"device.enable"}] comes before Starting device daemon..., but you asked me to sent that command after the daemon is connected, perhaps a timing issue?

Hmm, I was going to say no, since this always happens (for many of our services), and the service doesn't read stdin until it's ready. For ex here's my log:

[15:18:55]: Spawning /Users/dantup/Dev/Google/flutter/bin/flutter with args ["daemon"]
[15:18:55]: ..  in /Users/dantup/Dev/Google/flutter
[15:18:55]: PID: 49701
[15:18:55]: ==> [{"id":"1","method":"device.enable"}]
[15:18:56]: <== Starting device daemon...
[15:18:56]: <== [{"event":"daemon.connected","params":{"version":"0.4.2","pid":49720}}]
[15:18:56]: <== [{"id":"1"}]
[15:18:56]: <== [{"event":"device.added","params":{"id":"1DD6786B-37D4-4355-AA15-B818A87A18B4","name":"iPhone XS Max","platform":"ios","emulator":true}}]

However, I just looked back at yours, and there's no response to request 1, so you could be right, it doesn't seem like it was processes.

What happens if you run this from the terminal:

flutter daemon <<< '[{"id":"1","method":"device.enable"}]'

This should do the same thing - send the request immediately, before the server is ready.

@chengyuhui
Copy link
Author

I used a similar way on Windows -- pasting in the command and hit enter when the script is running some git commands (trying to pipe the command resulted a strange behavior: the command exits after daemon started).

However, the device did not show up until I issued the same command again.

C:\Users\cheng>flutter daemon -v
[  +15 ms] executing: [C:\Users\cheng\Documents\Software\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +405 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +3 ms] origin/stable
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git rev-parse --abbrev-ref HEAD
[{"id":"1","method":"device.enable"}][ +425 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +4 ms] stable
[   +1 ms] executing: [C:\Users\cheng\Documents\Software\flutter\] git ls-remote --get-url origin

[ +482 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git log -n 1 --pretty=format:%H
[ +394 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +1 ms] 8661d8aecd626f7f57ccbcb735553edc05a2e713
[        ] executing: [C:\Users\cheng\Documents\Software\flutter\] git log -n 1 --pretty=format:%ar
[ +470 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[   +3 ms] 10 weeks ago
[   +2 ms] executing: [C:\Users\cheng\Documents\Software\flutter\] git describe --match v*.*.* --first-parent --long
--tags
[ +896 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[   +2 ms] v1.2.1-0-g8661d8aec
[ +575 ms] Starting device daemon...
[{"event":"daemon.connected","params":{"version":"0.4.2","pid":25400}}]
<======= It stops here, manually pasting below
[{"id":"1","method":"device.enable"}]
[{"id":"1"}]
[{"event":"device.added","params":{"id":"9723ff13","name":"MIX 2S","platform":"android-arm64","emulator":false}}]

@DanTup DanTup removed the awaiting info Requires more information from the customer to progress label Apr 22, 2019
@DanTup DanTup added this to the v2.26.0 milestone Apr 22, 2019
@DanTup
Copy link
Member

DanTup commented Apr 22, 2019

Sorry, didn't realise you were on Windows :)

I'm going to try and make a beta of the next version very soon, so I'll see if I can tweak this to wait for connection, and then you can test with that. Thanks for the debugging!

@DanTup DanTup closed this as completed in 2bfdaa0 Apr 22, 2019
@chengyuhui
Copy link
Author

Thanks, and please let me know when that version comes out.

@DanTup
Copy link
Member

DanTup commented Apr 23, 2019

@chengyuhui it's not totally ready yet (the release notes are a 404, for ex.) but you can grab the build here:

https://github.com/Dart-Code/Dart-Code/releases/tag/v2.26.0-beta.1

Info on installing preview releases is here:

https://dartcode.org/docs/installing-a-preview-release/

Let me know if this fixes your issue (or if you find any other problems in that version - you can open new issues for them). Thanks!

@chengyuhui
Copy link
Author

Thanks, now the device can be detected by vscode, but launching still fails (WebSocketException: Invalid WebSocket upgrade request). I will open a separate issue if needed.

@DanTup
Copy link
Member

DanTup commented Apr 23, 2019

@chengyuhui Great!

Yes, please open another issue for that. Be sure to include a log:

  • Run the Dart: Capture Logs command from the VS Code command palette
  • Tick the "Flutter Run" category
  • Try to launch your app and wait for it to fail
  • Click Stop Logging in the logging notification (which may have collapsed into the bell icon on the bottom right of the status bar)

Then include the log in the issue (or email it to logs@dartcode.org and including the GH issue number you opened). Thanks!

@chengyuhui
Copy link
Author

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
Copy link
Member

DanTup commented Apr 23, 2019

Great! I suspected it might be proxy related and the log probably would've shown this. Glad you're all sorted - if you do hit any problems, do open issues and we'll take a look. Thanks!

DanTup added a commit that referenced this issue Aug 22, 2019
@RaviPabari
Copy link

RaviPabari commented Sep 10, 2019

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.

@osamagamal65
Copy link

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. ^_^

@RaphaelWirawan
Copy link

RaphaelWirawan commented Jul 18, 2020

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.

I have the same problem but your solution doesnt seem to work for me @RaviPabari
when I try to run, it would just show this
image
and after clicking create android emulator I get this error
image
BTW I already have an android emulator running from android studio

@DanTup
Copy link
Member

DanTup commented Jul 18, 2020

@RaphaelWirawan do the devices show up when you run flutter devices from the terminal?

If so, can you post the full output of running fluter doctor -v in the terminal, and then also from running the Flutter: Run Flutter Doctor command from the VS Code command palette?

Thanks!

@jamieastley
Copy link

This is still an issue for me for iOS devices. If I have VSCode running and plug in an iOS device, VSCode doesn't detect it unless I run the reload window command.

[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.6 19G60d, locale en-AU)
    • Flutter version 1.17.5 at /Users/jamie/Library/flutter
    • Framework revision 8af6b2f038 (3 weeks ago), 2020-06-30 12:53:55 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/jamie/Library/Android/sdk
    • Platform android-29, build-tools 29.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_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] IntelliJ IDEA Ultimate Edition (version 2020.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

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

[✓] Connected device (1 available)
    • iPhone-SE • {redacted} • ios • iOS 13.5

@DanTup
Copy link
Member

DanTup commented Jul 21, 2020

@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!

@ViviVR7
Copy link

ViviVR7 commented Apr 21, 2021

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

@ghost
Copy link

ghost commented May 20, 2021

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.

@DanTup
Copy link
Member

DanTup commented May 20, 2021

@rajeshjeshar is it completely solved, or are you still having issues with your other project? If so, please file a new issue and we can troubleshoot there. Thanks!

@ghost
Copy link

ghost commented May 28, 2021

@DanTup Its, solved when I opened my another project folder, then I closed it and re-opened my main project folder, so it's closed.

@adisonmasih
Copy link

This Happened To Me Once. I Had Plugged In My Device Into A USB 3.0 Port On My Macbook and the cable I was using, didn't support it. so once I replugged it into the USD 2.0 Port, it detected it immediately.

@rodepedroso
Copy link

Meu dispositivo não foi detectado hoje, foi detectado antes, verificando se a opção do desenvolvedor está ativada, mas descobri que a depuração USB está desativada de alguma forma, ative-o e tudo está bem

Isso tb funcionou para mim.

@abdorll
Copy link

abdorll commented Jul 28, 2021

I had the same error while trying to run my flutter project on VSCode to my device via USB cord, but after I changed my USB cord, it worked fine without running any other command

@he-mark-qinglong
Copy link

update the pubspec.yaml and then save it , vs code will show the "flutter pub get"result, then it would helps you solve the problems. if it successed, device should show.

@huanlirui
Copy link

我在状态栏中找不到“无设​​备”,只有 Flutter 版本。

确保您.dart打开了一个文件,如果它仍然没有出现,请附上屏幕截图。

不过,似乎 Flutter 中可能有很大的问题,但只是为了获取更多信息,您可以这样做:

  • 运行flutter devices并确认您的设备出现
  • flutter daemon -v
  • 一旦守护进程说它已连接,粘贴[{"id":"1","method":"device.enable"}]到终端并按<enter>(你应该看到[{"id":"1"}]打印出来)
  • 断开您的设备
  • 等待 10 秒
  • 重新连接您的设备

然后在此处粘贴所有这些的完整输出。

谢谢!

thanks It works for me

@mohammed7aafar
Copy link

just restart the VScode and that's it.

@roshandroids
Copy link

sudo xcodebuild -runFirstLaunch

Worked for me Thanks 🥳

@msayed-net
Copy link

Worked after restarting my mac.

@rajput-hemant
Copy link

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.

@DanTup
Copy link
Member

DanTup commented Aug 8, 2022

@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 #2124 for additional notes about the same sort of issue.

@rajput-hemant
Copy link

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

@bensonarafat
Copy link

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

@DanTup
Copy link
Member

DanTup commented Nov 8, 2022

@realArafatBen if you're able to reproduce this because of another extension, please let me know which extension so I can investigate what's happening and find a way to resolve it. Thanks!

@bensonarafat
Copy link

@DanTup I uninstall the extension but I think I still remember the name.. Todo list by Tzach Ovadia using the debugger at vscode that is how I find out about the issue.

@DanTup
Copy link
Member

DanTup commented Nov 8, 2022

@realArafatBen I tried installing that extension, but wasn't able to reproduce this - all devices show up correctly.

If you can reproduce this, I'd be interested in some more info (such as a screenshot of what you saw in the debugger). If you can file a new issue here with details, I'll take a look.

@domtom1126
Copy link

The problem for me was that I was using a USB-C dock for my Mac and plugging my iPhone into the dock rather than the Mac itself. I spend about 5-10 minutes restarting VSCode, restarting computer, running through Xcode all to realize I have to plug my USB-C to lightening directly into the computer rather than just into the dock.

@NilverDev
Copy link

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

@DanTup
Copy link
Member

DanTup commented Mar 6, 2023

I would be careful deleting that folder, it may include all of your extensions, settings etc.

If you want to force an extension reinstall, you could just install the dart-code.* folders from inside the extensions sub-folder. Although, if re-installing the extension solves an issue like this, I would be interested in a new issue filing (and if possible, a copy of the folder that was deleted) to investigate how that's affecting this behaviour.

@rahil627
Copy link

rahil627 commented Aug 28, 2023

okay, i've got a funky setup so it's my fault really (crostini / chromeos with arch container with ungoogled-chromium package).. but who knows??

after I enter that line in either vs code terminal or not, i do get the web "device" i'm lookin' for, but the option still doesn't show up in the vs code selection menu

[{"event":"device.added","params":{"id":"chrome","name":"Chrome","platform":"web-javascript","emulator":false,"category":"web","platformType":"web","ephemeral":false,"emulatorId":null,"sdk":"Chromium 116.0.5845.96 Arch Linux","capabilities":{"hotReload":true,"hotRestart":true,"screenshot":false,"fastStart":false,"flutterExit":false,"hardwareRendering":true,"startPaused":true}}}]

update: i am able to run flutter run -d chrome... it takes an incredible 140 seconds to show a page with a very slow status bar, but it's doing something, lol.

to note: I had an earlier problem where running the flutter doctor command ran fine in the system terminal but not in the vs code terminal. It was because I was using fish shell (and adding the env var to fish shell) and i think vs code uses bash, so I had to add the env var to either settings.json or .bashrc.

@DanTup
Copy link
Member

DanTup commented Aug 29, 2023

@rahil627 have you had to set CHROME_EXECUTABLE to make this work (from the terminal)? If so, did you also set it in "dart.env" as described above?

If that's not the issue, please open a new issue with as much detail about the setup and what you've configured as you can and we can debug further. Thanks!

@rahil627
Copy link

hey, yeah, I set CHROME_EXECUTABLE in both .bashrc and in the settings.json (dart.env), but I don't feel it's such a big issue as I can just run it from command-line...

thanks though. :)

if I ever truly figure it out, i'll keep ya posted!

@DanTup
Copy link
Member

DanTup commented Aug 30, 2023

@rahil627 if you've set it in dart.env too and it's still not working, please open a new issue (and including the output of running the Flutter: Run Flutter Doctor command inside VS Code) so we can figure out what's wrong. Thanks!

@namkazt
Copy link

namkazt commented Feb 17, 2024

@DanTup still happened to me, i tried everything to setup but still no device on vscode and android studio.

i'm on windows too. please take a look at this issue: flutter/flutter#143625

also i try to run like you said and here is the log:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in flutter Relates to running Flutter apps is bug
Projects
None yet
Development

No branches or pull requests