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

Failed to initialize connection to any devices after upgrading to v3.3.0 #1919

Closed
samcsk opened this issue Aug 8, 2019 · 20 comments
Closed
Labels
awaiting info Requires more information from the customer to progress in flutter Relates to running Flutter apps is bug
Milestone

Comments

@samcsk
Copy link

samcsk commented Aug 8, 2019

Steps to reproduce:

Dart Code v3.3.0, Flutter Code v3.3.0

1. Pressing F5 in editor
2. Selecting 'Start pixel_2 mobile emulator' at the 'Select a device to use' menu.

Available options:

Start pixel_2 mobile emulator
Create Android Emulator

*Despite an adb debuggable device was connected, no other devices were shown in the list.

3. The following error messages were shown, depending on the AVD was already running or not:

If already running...

Cannot launch without an active device
Failed to launch pixel_2: emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature. Please use -read-only flag to enable this feature.

If not running...

Launching pixel_2...
Android emulator launching
Waiting for pixel_2 to connect...
Android emulator launched
Failed to launch pixel_2: Error: Emulator didn't connect within 60 seconds

*Similar behavior was observed if 'Create Android Emulator' was selected in Step 2.

4. No messages were logged in 'DEBUG CONSOLE' of VS Code

The above issue was also observed under Dart Code v3.3.0, Flutter Code v3.2.0

The above issue was not observed under
Dart Code v3.2.1, Flutter Code v3.3.0 nor Dart Code v3.2.1, Flutter Code v3.2.0
and everything behaves normally.

Everything also works normally if using flutter commands manually in terminal, e.g. flutter devices or flutter run -d <deviceID>

Log:

Dart Code extension: 3.3.0
Flutter extension: 3.3.0 (not activated)
VS Code: 1.36.1
Platform: win
Workspace type: Flutter
Multi-root?: false
Dart SDK:
    Loc: C:\flutter\bin\cache\dart-sdk
    Ver: 2.4.0
Flutter SDK:
    Loc: C:\flutter
    Ver: 1.7.8+hotfix.4
HTTP_PROXY: undefined
NO_PROXY: undefined

[11:28:13 PM] [General] [Info] Starting debug session...
[11:28:13 PM] [General] [Info]     workspace: C:\Users\Username\Documents\Code\project_name
[11:28:13 PM] [General] [Info] Using found common entry point: C:\Users\Username\Documents\Code\project_name\lib\main.dart
[11:28:13 PM] [General] [Info] Using workspace as cwd: C:\Users\Username\Documents\Code\project_name
[11:28:13 PM] [General] [Info] Detected launch project as Flutter
[11:28:13 PM] [General] [Info] Using Flutter debug adapter for this session
[11:28:13 PM] [FlutterDaemon] [Info] ==> [{"id":"10","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\Username\\Documents\\Code\\project_name"}}]
[11:28:13 PM] [FlutterDaemon] [Info] <== [{"id":"10","result":{"platforms":["ios","android"]}}]
[11:28:13 PM] [FlutterDaemon] [Info] ==> [{"id":"11","method":"emulator.getEmulators"}]
[11:28:13 PM] [FlutterDaemon] [Info] <== [{"id":"11","result":[{"id":"Pixel_2_API_28","name":"pixel_2","category":"mobile","platformType":"android"}]}]
[11:28:14 PM] [FlutterDaemon] [Info] ==> [{"id":"12","method":"emulator.launch","params":{"emulatorId":"Pixel_2_API_28"}}]
[11:28:16 PM] [FlutterDaemon] [Info] <== [{"id":"12","error":"emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.\r\nPlease use -read-only flag to enable this feature.","trace":"#0      AndroidEmulator.launch.<anonymous closure> (package:flutter_tools/src/android/android_emulator.dart:58:17)\n#1      _rootRunUnary (dart:async/zone.dart:1132:38)\n#2      _CustomZone.runUnary (dart:async/zone.dart:1029:19)\n#3      _FutureListener.handleValue (dart:async/future_impl.dart:126:18)\n#4      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)\n#5      Future._propagateToListeners (dart:async/future_impl.dart:668:32)\n#6      Future._completeWithValue (dart:async/future_impl.dart:483:5)\n#7      Future.wait.<anonymous closure> (dart:async/future.dart:400:22)\n#8      _rootRunUnary (dart:async/zone.dart:1132:38)\n#9      _CustomZone.runUnary (dart:async/zone.dart:1029:19)\n#10     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)\n#11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)\n#12     Future._propagateToListeners (dart:async/future_impl.dart:668:32)\n#13     Future._complete (dart:async/future_impl.dart:473:7)\n#14     Stream.fold.<anonymous closure> (dart:async/stream.dart:742:18)\n#15     _rootRun (dart:async/zone.dart:1120:38)\n#16     _CustomZone.run (dart:async/zone.dart:1021:19)\n#17     _CustomZone.runGuarded (dart:async/zone.dart:923:7)\n#18     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)\n#19     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)\n#20     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)\n#21     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)\n#22     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)\n#23     _WindowsCodePageDecoderSink.close (dart:io/string_transformer.dart:124:11)\n#24     _ConverterStreamEv…
[11:28:16 PM] [General] [Warn] Unable to launch due to no active device

flutter doctor -v:

[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.18362.264], locale en-__)
    • Flutter version 1.7.8+hotfix.4 at C:\flutter
    • Framework revision 20e59316b8 (3 weeks ago), 2019-07-18 20:04:33 -0700
    • Engine revision fee001c93f
    • Dart version 2.4.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    • Android SDK at C:\Users\Username\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.4)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 38.1.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] VS Code (version 1.36.1)
    • VS Code at C:\Users\Username\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.2.0

[√] Connected device (2 available)
    • ONEPLUS A3003             • placeholder  • android-arm64 • Android 9 (API 28)
    • Android SDK built for x86 • emulator-5554 • android-x86   • Android 9 (API 28) (emulator)

My current workaround: Downgrading to Dart-Code v3.2.1
Possibly related issues: #1885, #1878

Many thanks.
I'd love to use the new Flutter Outline feature.

@DanTup DanTup added this to the v3.4.0 milestone Aug 8, 2019
@DanTup DanTup added in flutter Relates to running Flutter apps is bug labels Aug 8, 2019
@DanTup
Copy link
Member

DanTup commented Aug 19, 2019

Sorry for the delay, I was out of office. I'm unable to reproduce this - could you try capturing a log?

  • Run the Dart: Capture Logs command from the command palette
  • Untick Analysis Server but leave everything else ticked and click OK
  • Reproduce the issue
  • Click Stop Logging on the notification (which may have collapsed into the bell in the status bar)
  • Attach the log here/paste into a gist and provide the link

Thanks!

@DanTup
Copy link
Member

DanTup commented Aug 19, 2019

I tested on Windows in case that made a difference, but still couldn't repro. I did notice that when it launched, it took a long time to start up - so probably came close to 60 seconds - it's possible that timeout is a bit low.

When I tried to run it with the emulator already running though, it just selected it and did not ask me to start it.

@samcsk
Copy link
Author

samcsk commented Aug 19, 2019

Hi, here and here are two logs I just captured on my Windows machine, unfortunately the issue is still reproducible for me, even with all other extensions disabled or on a freshly initialized project.

That said I could not reproduce this issue on my macOS machine debugging on the same project, with the same physical device attached, and with the same extensions installed.

@DanTup
Copy link
Member

DanTup commented Aug 19, 2019

It seems like the issue is that flutter daemon isn't picking up the device, so a) we try to launch it even if it's already running and b) we never detect that it launched when when we did tell it to start.

Can you post the output of flutter devices -v when the device is running (and therefore should show up there)?

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

samcsk commented Aug 19, 2019

No problem.
Yes, indeed it does.

PS C:\Users\Username\Documents\Code\flutter_test\fluttertest> flutter devices -v
[  +29 ms] executing: [C:\flutter\] git log -n 1 --pretty=format:%H
[ +143 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +2 ms] 20e59316b8b8474554b38493b8ca888794b0234a
[        ] executing: [C:\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +125 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.7.8+hotfix.4-0-g20e59316b
[   +9 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +117 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\flutter\] git ls-remote --get-url origin
[ +107 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +149 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref HEAD
[ +117 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +42 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[  +21 ms] executing: C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +18 ms] Exit code 0 from: C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[   +1 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
[  +10 ms] 1 connected device:

[   +4 ms] C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell getprop
[  +53 ms] ro.hardware = ranchu
[   +4 ms] Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
[   +9 ms] "flutter devices" took 163ms.
[        ] "flutter devices" took 163ms.

@DanTup
Copy link
Member

DanTup commented Aug 19, 2019

Strange - that should just be running the same code. Can you try this:

flutter daemon -v

Wait until you see a line that says "daemon.connected", and then paste the following into the terminal and press <enter>:

[{ "id": "1", "method": "device.enable" }]

Then wait a few seconds and hit Ctrl+C to terminate it and paste the output (if there is any) here.

@samcsk
Copy link
Author

samcsk commented Aug 21, 2019

Sorry for the delay.
Here's what I got from the terminal:

PS C:\Users\Username\Documents\Code\flutter_test\fluttertest> flutter daemon -v
[  +29 ms] executing: [C:\flutter\] git log -n 1 --pretty=format:%H
[ +143 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +3 ms] 20e59316b8b8474554b38493b8ca888794b0234a
[        ] executing: [C:\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +131 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.7.8+hotfix.4-0-g20e59316b
[  +10 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +120 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\flutter\] git ls-remote --get-url origin
[ +108 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +143 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref HEAD
[ +111 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +44 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +2 ms] Starting device daemon...
[{"event":"daemon.connected","params":{"version":"0.5.2","pid":48548}}]
[{ "id": "1", "method": "device.enable" }]
[{"id":"1"}]

There's nothing more showing up before and after I terminated the command via Ctrl+C a good few minutes later.

@DanTup
Copy link
Member

DanTup commented Aug 21, 2019

@orange-droplet would you mind modifying your Flutter SDK slightly to try and debug this? My guess is that under the daemon we're not finding the adb path (but I can't find any reason why it'd be different versus flutter devices).

You could try the following:

  1. Open the file packages\flutter_tools\lib\src\android\android_device.dart from your Flutter SDK
  2. Locate the method List<AndroidDevice> getAdbDevices() {
  3. Replace it with the following implementation that has some prints
List<AndroidDevice> getAdbDevices() {
  print('Looking for devices');
  final String adbPath = getAdbPath(androidSdk);
  print('adbPath is $adbPath');
  if (adbPath == null)
    return <AndroidDevice>[];
  String text;
  try {
    text = runSync(<String>[adbPath, 'devices', '-l']);
    print('adbPath output $text');
  } on ArgumentError catch (exception) {
    throwToolExit('Unable to find "adb", check your Android SDK installation and '
      'ANDROID_HOME environment variable: ${exception.message}');
  } on ProcessException catch (exception) {
    throwToolExit('Unable to run "adb", check your Android SDK installation and '
      'ANDROID_HOME environment variable: ${exception.executable}');
  }
  final List<AndroidDevice> devices = <AndroidDevice>[];
  parseADBDeviceOutput(text, devices: devices);
  print('found ${devices.length} devices');
  return devices;
}
  1. Delete the file at bin\cache\flutter_tools.snapshot in your Flutter SDK
  2. Repeat the test you did above (run the daemon, paste the "device.enable" call)

This should give us an idea if ADB is being found and called or not.

In order to restore your SDK to normal, you should revert the android_device.dart file (eg. remove the prints) and then re-delete the flutter_tools.snapshot file.

@samcsk
Copy link
Author

samcsk commented Aug 21, 2019

Here's the output:

PS C:\Users\Username\Documents\Code\flutter_test\fluttertest> flutter daemon -v
[  +17 ms] Waiting to be able to obtain lock of Flutter binary artifacts directory: C:\flutter\bin\cache\lockfile
[  +11 ms] Waiting for another flutter command to release the startup lock...
[ +635 ms] executing: [C:\flutter\] git log -n 1 --pretty=format:%H
[ +132 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[        ] 20e59316b8b8474554b38493b8ca888794b0234a
[        ] executing: [C:\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +118 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.7.8+hotfix.4-0-g20e59316b
[  +10 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +117 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\flutter\] git ls-remote --get-url origin
[ +107 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +140 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref HEAD
[ +115 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +35 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.  
[   +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[{"event":"daemon.connected","params":{"version":"0.5.2","pid":55856}}]
[{ "id": "1", "method": "device.enable" }]
[{"id":"1"}]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
found 0 devices
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
found 0 devices
Looking for devices
(...same response repeating afterwards...)
^CTerminate batch job (Y/N)? y

In case if it helps, here's a response recording a trial of booting up an AVD after pasting [{ "id": "1", "method": "device.enable" }]:

PS C:\Users\Username\Documents\Code\flutter_test\fluttertest> flutter daemon -v
[  +29 ms] executing: [C:\flutter\] git log -n 1 --pretty=format:%H
[ +145 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +2 ms] 20e59316b8b8474554b38493b8ca888794b0234a
[        ] executing: [C:\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +119 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.7.8+hotfix.4-0-g20e59316b
[   +9 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +122 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\flutter\] git ls-remote --get-url origin
[ +113 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +150 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref HEAD
[ +116 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +37 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +6 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +1 ms] Starting device daemon...
[{"event":"daemon.connected","params":{"version":"0.5.2","pid":49640}}]
[{ "id": "1", "method": "device.enable" }]
[{"id":"1"}]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
found 0 devices
	[Emulator launching...]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          offline transport_id:6
found 0 devices
	(same repeating responses...)
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          offline transport_id:6
found 0 devices
	[Emulator finished booting into launcher...]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:6
found 1 devices
[{"event":"device.added","params":{"id":"emulator-5554","name":"Android SDK built for x86","platform":"android-x86","emulator":true,"category":"mobile","platformType":"android","ephemeral":true}}]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:6
found 1 devices
	(same repeating responses...)
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:6
found 1 devices
	[Emulator closed manually...]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
found 0 devices
[{"event":"daemon.logMessage","params":{"level":"error","message":"Error 1 retrieving device properties for ro.product.cpu.abi:"}}]
[{"event":"daemon.logMessage","params":{"level":"error","message":"error: device 'emulator-5554' not found\r\n"}}]
[{"event":"device.removed","params":{"id":"emulator-5554","name":"Android SDK built for x86","platform":"android-arm","emulator":false,"category":"mobile","platformType":"android","ephemeral":true}}]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
found 0 devices
	(same repeating responses...)

@DanTup
Copy link
Member

DanTup commented Aug 21, 2019

Sorry, I wasn't clear the first time the emulator should be running. It seems like this is working correctly though, it is finding the emulator.

If it's not working from VS Code, it could be something to do with the environment. You could enable the daemon log file:

https://dartcode.org/docs/logging/#flutter-daemon

Then launch VS Code and open a Flutter project while the emulator is open. It might report some errors and not show the devices, however the log file will hopefully capture similar output to above - verifying whether it's finding the adb path there or not.

@samcsk
Copy link
Author

samcsk commented Aug 21, 2019

Here's the log output:

Dart Code extension: 3.3.0
Flutter extension: 3.3.0 (not activated)
VS Code: 1.37.1
Platform: win
Workspace type: Flutter
Multi-root?: false
Dart SDK:
    Loc: C:\flutter\bin\cache\dart-sdk
    Ver: 2.4.0
Flutter SDK:
    Loc: C:\flutter
    Ver: 1.7.8+hotfix.4
HTTP_PROXY: undefined
NO_PROXY: undefined

[11:09:07 PM]: Spawning C:\flutter\bin\flutter.bat with args ["daemon"]
[11:09:07 PM]: ..  in C:\flutter
[11:09:07 PM]: PID: 52740
[11:09:07 PM]: ==> [{"id":"1","method":"device.enable"}]
[11:09:08 PM]: <== Starting device daemon...
[11:09:08 PM]: <== [{"event":"daemon.connected","params":{"version":"0.5.2","pid":60956}}]
[11:09:20 PM]: ==> [{"id":"2","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\Username\\Documents\\Code\\flutter_test\\fluttertest"}}]
[11:09:21 PM]: <== [{"id":"2","result":{"platforms":["ios","android"]}}]
[11:09:21 PM]: ==> [{"id":"3","method":"emulator.getEmulators"}]
[11:09:21 PM]: <== [{"id":"3","result":[{"id":"Pixel_2_API_28","name":"pixel_2","category":"mobile","platformType":"android"},{"id":"flutter_emulator","name":"pixel","category":"mobile","platformType":"android"}]}]
[11:09:22 PM]: ==> [{"id":"4","method":"emulator.launch","params":{"emulatorId":"Pixel_2_API_28"}}]
[11:09:24 PM]: <== [{"id":"4","error":"emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.\r\nPlease use -read-only flag to enable this feature.","trace":"#0      AndroidEmulator.launch.<anonymous closure> (package:flutter_tools/src/android/android_emulator.dart:58:17)\n#1      _rootRunUnary (dart:async/zone.dart:1132:38)\n#2      _CustomZone.runUnary (dart:async/zone.dart:1029:19)\n#3      _FutureListener.handleValue (dart:async/future_impl.dart:126:18)\n#4      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)\n#5      Future._propagateToListeners (dart:async/future_impl.dart:668:32)\n#6      Future._completeWithValue (dart:async/future_impl.dart:483:5)\n#7      Future.wait.<anonymous closure> (dart:async/future.dart:400:22)\n#8      _rootRunUnary (dart:async/zone.dart:1132:38)\n#9      _CustomZone.runUnary (dart:async/zone.dart:1029:19)\n#10     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)\n#11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)\n#12     Future._propagateToListeners (dart:async/future_impl.dart:668:32)\n#13     Future._complete (dart:async/future_impl.dart:473:7)\n#14     Stream.fold.<anonymous closure> (dart:async/stream.dart:742:18)\n#15     _rootRun (dart:async/zone.dart:1120:38)\n#16     _CustomZone.run (dart:async/zone.dart:1021:19)\n#17     _CustomZone.runGuarded (dart:async/zone.dart:923:7)\n#18     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)\n#19     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)\n#20     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)\n#21     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)\n#22     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)\n#23     _WindowsCodePageDecoderSink.close (dart:io/string_transformer.dart:124:11)\n#24     _ConverterStreamEve…

@DanTup
Copy link
Member

DanTup commented Aug 21, 2019

Sorry, I didn't make it clear you should do this when the print statements are still there (and you've deleted the snapshot to ensure they'll work). We're aiming to see whether when running from VS Code we get different output to when you ran from the terminal (eg. does it fail to find an ADB path).

Thanks for digging!

@samcsk
Copy link
Author

samcsk commented Aug 22, 2019

Today I tried running it again after making sure that the print statements are still there but the log outputs are still the same, maybe I am missing something?

flutterDaemon.txt

Dart Code extension: 3.3.0
Flutter extension: 3.3.0 (not activated)
VS Code: 1.37.1
Platform: win
Workspace type: Flutter
Multi-root?: false
Dart SDK:
    Loc: C:\flutter\bin\cache\dart-sdk
    Ver: 2.4.0
Flutter SDK:
    Loc: C:\flutter
    Ver: 1.7.8+hotfix.4
HTTP_PROXY: undefined
NO_PROXY: undefined

[8:05:07 PM]: Spawning C:\flutter\bin\flutter.bat with args ["daemon"]
[8:05:07 PM]: ..  in C:\flutter
[8:05:07 PM]: PID: 40508
[8:05:07 PM]: ==> [{"id":"1","method":"device.enable"}]
[8:05:09 PM]: <== Starting device daemon...
[8:05:09 PM]: <== [{"event":"daemon.connected","params":{"version":"0.5.2","pid":65876}}]
[8:05:14 PM]: ==> [{"id":"2","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\Username\\Documents\\Code\\flutter_test\\fluttertest"}}]
[8:05:14 PM]: <== [{"id":"2","result":{"platforms":["ios","android"]}}]
[8:05:14 PM]: ==> [{"id":"3","method":"emulator.getEmulators"}]
[8:05:14 PM]: <== [{"id":"3","result":[{"id":"Pixel_2_API_28","name":"pixel_2","category":"mobile","platformType":"android"},{"id":"flutter_emulator","name":"pixel","category":"mobile","platformType":"android"}]}]
[8:05:31 PM]: ==> [{"id":"4","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\Username\\Documents\\Code\\flutter_test\\fluttertest"}}]
[8:05:31 PM]: <== [{"id":"4","result":{"platforms":["ios","android"]}}]
[8:05:31 PM]: ==> [{"id":"5","method":"emulator.getEmulators"}]
[8:05:31 PM]: <== [{"id":"5","result":[{"id":"Pixel_2_API_28","name":"pixel_2","category":"mobile","platformType":"android"},{"id":"flutter_emulator","name":"pixel","category":"mobile","platformType":"android"}]}]
[8:05:32 PM]: ==> [{"id":"6","method":"emulator.launch","params":{"emulatorId":"Pixel_2_API_28"}}]
[8:05:34 PM]: <== [{"id":"6","error":"emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.\r\nPlease use -read-only flag to enable this feature.","trace":"#0      AndroidEmulator.launch.<anonymous closure> (package:flutter_tools/src/android/android_emulator.dart:58:17)\n#1      _rootRunUnary (dart:async/zone.dart:1132:38)\n#2      _CustomZone.runUnary (dart:async/zone.dart:1029:19)\n#3      _FutureListener.handleValue (dart:async/future_impl.dart:126:18)\n#4      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)\n#5      Future._propagateToListeners (dart:async/future_impl.dart:668:32)\n#6      Future._completeWithValue (dart:async/future_impl.dart:483:5)\n#7      Future.wait.<anonymous closure> (dart:async/future.dart:400:22)\n#8      _rootRunUnary (dart:async/zone.dart:1132:38)\n#9      _CustomZone.runUnary (dart:async/zone.dart:1029:19)\n#10     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)\n#11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)\n#12     Future._propagateToListeners (dart:async/future_impl.dart:668:32)\n#13     Future._complete (dart:async/future_impl.dart:473:7)\n#14     Stream.fold.<anonymous closure> (dart:async/stream.dart:742:18)\n#15     _rootRun (dart:async/zone.dart:1120:38)\n#16     _CustomZone.run (dart:async/zone.dart:1021:19)\n#17     _CustomZone.runGuarded (dart:async/zone.dart:923:7)\n#18     _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)\n#19     _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)\n#20     _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)\n#21     _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)\n#22     _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)\n#23     _WindowsCodePageDecoderSink.close (dart:io/string_transformer.dart:124:11)\n#24     _ConverterStreamEve…

Terminal output, at the same time:

PS C:\Users\Username\Documents\Code\flutter_test\fluttertest> flutter daemon -v
[  +29 ms] executing: [C:\flutter\] git log -n 1 --pretty=format:%H
[ +142 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +2 ms] 20e59316b8b8474554b38493b8ca888794b0234a
[        ] executing: [C:\flutter\] git describe --match v*.*.* --first-parent --long --tags
[ +119 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.7.8+hotfix.4-0-g20e59316b
[  +10 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +117 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\flutter\] git ls-remote --get-url origin
[ +109 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +151 ms] executing: [C:\flutter\] git rev-parse --abbrev-ref HEAD
[ +116 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +35 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.  
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.    
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.    
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +3 ms] Starting device daemon...
[{"event":"daemon.connected","params":{"version":"0.5.2","pid":67848}}]
[{ "id": "1", "method": "device.enable" }]
[{"id":"1"}]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
found 1 devices
[{"event":"device.added","params":{"id":"emulator-5554","name":"Android SDK built for x86","platform":"android-x86","emulator":true,"category":"mobile","platformType":"android","ephemeral":true}}]
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
found 1 devices
Looking for devices
adbPath is C:\Users\Username\AppData\Local\Android\sdk\platform-tools\adb.exe
adbPath output List of devices attached
emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
found 1 devices

Thanks!

@DanTup
Copy link
Member

DanTup commented Aug 22, 2019

Right, I think I've spotted the error in your last log. We send this:

==> [{"id":"1","method":"device.enable"}]

But we never get a response to it (we see <== [{"id":"1"}] in the working ones). This makes me think the message is not being processed - possibly because it's being sent before the daemon i s properly running - though I was expecting it would just sit in the stdin buffer until it was read.

I'll do some digging...

@DanTup
Copy link
Member

DanTup commented Aug 22, 2019

Ok, tracked this down. I've fixed it in the past (2bfdaa0) but apparently broke it during a refactor at 62328e5.

Sorry for the bother, and thanks for all the effort digging into what turned out to be something silly!

@DanTup DanTup closed this as completed in 8d113ae Aug 22, 2019
@samcsk
Copy link
Author

samcsk commented Aug 22, 2019

Hey, good to hear that the source of the problem was found!
Thank you very much.

@DanTup
Copy link
Member

DanTup commented Aug 22, 2019

I made a build of the current code if this is blocking you and you want to try the fix:

https://github.com/Dart-Code/Dart-Code/releases/tag/v3.4.0-beta.1

Download the VSIX file, then run the Extensions: Install from VSIX command in VS Code and browse to the VSIX.

If you have any problems with that build, do open new issues and I'll fix them right away. When the next version is released stable, you'll automatically be upgraded to it (so you don't need to worry about uninstalling the beta).

@samcsk
Copy link
Author

samcsk commented Aug 22, 2019

I can confirm that it works properly now in the beta version. Really grateful that this issue get ironed out.

@DanTup
Copy link
Member

DanTup commented Aug 22, 2019

Great! And no problem - thanks for helping me debug it!

I'm not sure why it happened reliably for some users and not others (or why the initial message seemed to be lost - I verified the stream is single-subscription, and couldn't find a way for it to be consumed prior to the device discoverers being added), but at least it's sorted.

@exeptionerror

This comment was marked as spam.

@Dart-Code Dart-Code temporarily blocked exeptionerror Jun 14, 2021
@Dart-Code Dart-Code temporarily blocked exeptionerror Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting info Requires more information from the customer to progress in flutter Relates to running Flutter apps is bug
Projects
None yet
Development

No branches or pull requests

3 participants