VS Code "More than one device connected"

1,595 views
Skip to first unread message

Simon Rasmussen

unread,
Oct 2, 2019, 11:04:44 AM10/2/19
to Flutter Development (flutter-dev)
When I installed Flutter I couldn't get anything running on the default emulator. I create 2 new ones.
Now when I open VS Code and choose one of my new emulator and run my file I get: "More than one device connected".

Can I delete the default emulator? 

If I run with 'flutter run -d deviceID' it will often crash completely and PC is unreachable for a few minutes.

Appreciate any help 

Simon Rasmussen

unread,
Oct 2, 2019, 11:26:38 AM10/2/19
to Flutter Development (flutter-dev)
It seems Android Studio has a menu option. But I'd like to show devices and delete the ones I need to delete, within powershell in. Is this possible?

Taksan

unread,
Oct 2, 2019, 5:01:02 PM10/2/19
to Simon Rasmussen, Flutter Development (flutter-dev)
not sure what you did to create that scenario.... you have two emulators started at the same time? or many you have one emulator AND your phone connected at the same time?

anyways.... just make sure you only have one target started/connected .... an emulator... your phone...

and to manage virtual devices or emulators... just use android studio... nice GUI for that.... no need to mess with command line or poweshell....

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/e5565911-6f99-4b62-aba2-a07d812cd6e4%40googlegroups.com.

Simon Rasmussen

unread,
Oct 2, 2019, 5:47:37 PM10/2/19
to Flutter Development (flutter-dev)
When i started running Flutter both Android studio and VS Code showed my phone as default device - not sure how/why.
I can run with -d <deviceid> and that works. 

Thanks for the tip on using android studio. Strange to me that the command line way is to troublesome for something rather simple.
In android studio I can delete the AVDs I have created myself, but can't remove my phone. 
Since I have never been able to run anything on the phone anyway I doesn't help me that it is the default. 



On Wednesday, October 2, 2019 at 11:01:02 PM UTC+2, Taksan wrote:
not sure what you did to create that scenario.... you have two emulators started at the same time? or many you have one emulator AND your phone connected at the same time?

anyways.... just make sure you only have one target started/connected .... an emulator... your phone...

and to manage virtual devices or emulators... just use android studio... nice GUI for that.... no need to mess with command line or poweshell....

On Wed, Oct 2, 2019 at 12:26 PM Simon Rasmussen <simon.r...@gmail.com> wrote:
It seems Android Studio has a menu option. But I'd like to show devices and delete the ones I need to delete, within powershell in. Is this possible?

On Wednesday, October 2, 2019 at 5:04:44 PM UTC+2, Simon Rasmussen wrote:
When I installed Flutter I couldn't get anything running on the default emulator. I create 2 new ones.
Now when I open VS Code and choose one of my new emulator and run my file I get: "More than one device connected".

Can I delete the default emulator? 

If I run with 'flutter run -d deviceID' it will often crash completely and PC is unreachable for a few minutes.

Appreciate any help 

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Simon Rasmussen

unread,
Oct 2, 2019, 5:48:22 PM10/2/19
to Flutter Development (flutter-dev)
Only reason to use phone (if I can get it working) would be to avoid slowing down my PC - the virtual engine is very CPU demanding on my system

Danny Tuppeny

unread,
Oct 3, 2019, 3:15:40 AM10/3/19
to Flutter Development (flutter-dev)
On Wednesday, 2 October 2019 16:04:44 UTC+1, Simon Rasmussen wrote:
When I installed Flutter I couldn't get anything running on the default emulator. I create 2 new ones.
Now when I open VS Code and choose one of my new emulator and run my file I get: "More than one device connected".

Can you clarify where you see this message appear and how you're running the app? When you start debugging, VS Code should pass a device ID (for the device shown in the status bar) to Flutter so this message shouldn't appear, but it doesn't sound like that's happening.

Deleting emulator images isn't possible directly through VS Code/Flutter but you can run avdmanager list avd to see a list of them and avdmanager delete avd -n name_to_delete to delete them.

Simon Rasmussen

unread,
Oct 3, 2019, 8:14:35 AM10/3/19
to Flutter Development (flutter-dev)
Thanks for you input Danny. In the meantime I have deleted some emulators through Taksan's advice to use Android Studio.

From the beginning android studio and VS Code have had my phone as default device. I don't know if it just automatically scans for android phones on the network or how this was setup. 

The problem came when I chose a virtual device, because then both devices where enabled. But I could then choose which device to run on.

Now it seems to be working fine. I would like to find some other solution though, as running the emulator is surprisingly taxing on CPU(!)

Danny Tuppeny

unread,
Oct 3, 2019, 8:25:52 AM10/3/19
to Flutter Development (flutter-dev)
On Thursday, 3 October 2019 13:14:35 UTC+1, Simon Rasmussen wrote:
Thanks for you input Danny. In the meantime I have deleted some emulators through Taksan's advice to use Android Studio.

From the beginning android studio and VS Code have had my phone as default device. I don't know if it just automatically scans for android phones on the network or how this was setup. 

The problem came when I chose a virtual device, because then both devices where enabled. But I could then choose which device to run on.

If you can reproduce this, I'd be interested to dig into what's happening. VS Code doesn't have a concept of a default or enabled device. It has a "selected device" which is shown in the status bar (there can be only one). When a new device is connected, if it's a mobile device then it will automatically be selected (the assumption is that if you've just connected a new device you're likely to want to use it).

Out of interest - are you running in VS Code using F5 (or Debug -> Start Debugging) or using the terminal?

 
Now it seems to be working fine. I would like to find some other solution though, as running the emulator is surprisingly taxing on CPU(!)

 What would you prefer to do - run on your physical phone? If so, what's preventing that? If you have your phone connected, it should be automatically selected (and shown in the status bar) in VS Code. If this doesn't seem to be working right, please do file a bug on GitHub and we can figure out what's happening.

Simon Rasmussen

unread,
Oct 3, 2019, 10:39:34 AM10/3/19
to Flutter Development (flutter-dev)
I have looked into it now. It turns out the 'default' device was not my phone, but a virtual Samsung Galaxy device.
Since I could not run anything on this, I created a virtual device myself, which led to my original question. 

I have been running in VS Code and I always use 'flutter run' and then hot reload with 'r'.

Since my computer is almost crashing several times a day due to the emulator, I guess running on the phone would be the best option. If I could make the emulator run on less CPU that would be even better though.
VS Code cannot detect my phone (connected with USB). I am not sure if adb is set up on my system, but I'm trying to read up on it. 

Appreciate your effort a lot ! In general with flutter so far many of these minor obstacles have taken me hours and hours to fixed. Much more troublesome than Python which I have some experience in.

Danny Tuppeny

unread,
Oct 3, 2019, 12:21:22 PM10/3/19
to Flutter Development (flutter-dev)
On Thursday, 3 October 2019 15:39:34 UTC+1, Simon Rasmussen wrote:
I have been running in VS Code and I always use 'flutter run' and then hot reload with 'r'.

If you run by pressing F5 (or clicking Debug -> Start Debugging, or Debug -> Start Without Debugging) instead you'll get more functionality (such as hot-reload-on-save, a full debugger, improved error messages etc.). We can't wire any of those up when running from the terminal (since the terminal is just a terminal).

If any of the experience running that way seems worse than running from the terminal, I'd definitely love to know (I often see people run from the terminal but it's not clear if it's because they've had issues with the debugger - if so, I'd love to try and address them so people don't have to give up other functionality).

 
Since my computer is almost crashing several times a day due to the emulator, I guess running on the phone would be the best option. If I could make the emulator run on less CPU that would be even better though.
VS Code cannot detect my phone (connected with USB). I am not sure if adb is set up on my system, but I'm trying to read up on it.

The output of flutter doctor -v might help understand what's wrong here, as well as adb devices when the phone is connected.

 
Appreciate your effort a lot ! In general with flutter so far many of these minor obstacles have taken me hours and hours to fixed. Much more troublesome than Python which I have some experience in.

I'm sorry to hear things have been bumpy. There are often a lot of people active on Gitter that might be able to help troubleshoot (there's flutter/flutter and a Dart-Code room for VS Code extension woes), and if there are things that can be improved by Flutter or the VS Code extension that could avoid others hitting the same issues, it's definitely worth opening GitHub issues (if there aren't any already).

Simon Rasmussen

unread,
Oct 3, 2019, 12:34:10 PM10/3/19
to Flutter Development (flutter-dev)
I have run the doctor command previously. I get no errors - all check marks.

I have just installed adb in VS Code and restartet VS Code. However when I run 'flutter adb devices' or 'adb devices' I get " adb : The term 'adb' is not recognized as the name of a cmdlet (...)".
I guess this is a good example of the kind of errors I have spend quite some time on in starting out with Flutter. 

Danny Tuppeny

unread,
Oct 3, 2019, 1:05:44 PM10/3/19
to Flutter Development (flutter-dev)
On Thursday, 3 October 2019 17:34:10 UTC+1, Simon Rasmussen wrote:
I have just installed adb in VS Code and restartet VS Code. However when I run 'flutter adb devices' or 'adb devices' I get " adb : The term 'adb' is not recognized as the name of a cmdlet (...)".

The command is just "adb devices". The error you got is because the path to ADB isn't in your PATH environment variable.

In the first instance, try "flutter devices" and see if your phone shows up there. If you haven't already, make sure your phone has USB debugging enabled and you have the USB driver (see these instructions). If that doesn't help, run "adb devices" to see if it shows up there (adb is a tool from the Android SDK - it's not Flutter-specific, but it's what Flutter uses to list Android devices). Since it's not in your PATH, you'll need to put the full path to it. If you run "flutter doctor -v" you'll see a line that tells you where your Android SDK is. adb lives inside a folder called platform-tools. So to run it on my MacBook I would use:

/Users/dantup/Library/Android/sdk/platform-tools/adb devices

This is the path of the Android SDK followed by "platform-tools/adb devices". On Windows the slashes will be the other way and the SDK path will start with a drive letter, but otherwise it should work the same.

If this still doesn't get you up and running, there are Gitter and Discord links in the Dart-Code readme - ping me there and if I'm around I'm sure we can get to the bottom of it fairly quickly.

Simon Rasmussen

unread,
Oct 3, 2019, 3:45:21 PM10/3/19
to Flutter Development (flutter-dev)
Thanks once again for your replies Danny!

Enabling USB debugging in developer mode made all the difference. 

This cleared quite an obstacle for me, so onwards now to mastering Flutter/Dart. 
Reply all
Reply to author
Forward
0 new messages