mmcc007 / screenshots

Screenshots: A command line utility and package for capturing screenshots for Flutter
Other
264 stars 144 forks source link

Fails if a physical device is available #185

Open zacps opened 4 years ago

zacps commented 4 years ago

Running screenshots fails if both a physical device and an emulator is available.

Starting flutter daemon...                                          1.2s
Warning: using default value 'phone' in fastlane directory.
Clearing images in android/fastlane/metadata/android/en-GB/images/phoneScreenshots for 'Pixel'...
Starting Pixel...
Unhandled exception:
Error: emulator Pixel not started: [{"event":"device.added","params":{"id":"a21aff4f","name":"ONEPLUS A6000","platform":"android-arm64","emulator":false,"category":"mobile","platformType":"android","ephemeral":true,"emulatorId":null}}]
#0      DaemonClient.launchEmulator (package:screenshots/src/daemon_client.dart:86:7)
<asynchronous suspension>
#1      startEmulator (package:screenshots/src/run.dart:434:31)
#2      Screenshots.runTestsOnAll (package:screenshots/src/run.dart:217:21)
#3      Screenshots.run (package:screenshots/src/run.dart:127:11)
<asynchronous suspension>
#4      screenshots.<anonymous closure> (package:screenshots/src/run.dart:48:26)
#5      AppContext.run.<anonymous closure> (package:tool_base/src/base/context.dart:154:29)
#6      _rootRun (dart:async/zone.dart:1126:13)
#7      _CustomZone.run (dart:async/zone.dart:1023:19)
#8      _runZoned (dart:async/zone.dart:1518:10)
#9      runZoned (dart:async/zone.dart:1465:12)
#10     AppContext.run (package:tool_base/src/base/context.dart:153:18)
#11     runInContext (package:screenshots/src/context_runner.dart:16:24)
#12     screenshots (package:screenshots/src/run.dart:47:12)
#13     main (file:///C:/Users/Zac/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/screenshots-2.1.1/bin/main.dart:122:25)
<asynchronous suspension>
#14     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
Starting flutter daemon...                                          1.9s
Warning: using default value 'phone' in fastlane directory.
Clearing images in android/fastlane/metadata/android/en-GB/images/phoneScreenshots for 'Pixel'...
Starting Pixel...
Unhandled exception:
Error: emulator Pixel not started: [{"event":"device.added","params":{"id":"a21aff4f","name":"ONEPLUS A6000","platform":"android-arm64","emulator":false,"category":"mobile","platformType":"android","ephemeral":true,"emulatorId":null}}]
#0      DaemonClient.launchEmulator (package:screenshots/src/daemon_client.dart:86:7)
<asynchronous suspension>
#1      startEmulator (package:screenshots/src/run.dart:434:31)
#2      Screenshots.runTestsOnAll (package:screenshots/src/run.dart:217:21)
#3      Screenshots.run (package:screenshots/src/run.dart:127:11)
<asynchronous suspension>
#4      screenshots.<anonymous closure> (package:screenshots/src/run.dart:48:26)
#5      AppContext.run.<anonymous closure> (package:tool_base/src/base/context.dart:154:29)
#6      _rootRun (dart:async/zone.dart:1126:13)
#7      _CustomZone.run (dart:async/zone.dart:1023:19)
#8      _runZoned (dart:async/zone.dart:1518:10)
#9      runZoned (dart:async/zone.dart:1465:12)
#10     AppContext.run (package:tool_base/src/base/context.dart:153:18)
#11     runInContext (package:screenshots/src/context_runner.dart:16:24)
#12     screenshots (package:screenshots/src/run.dart:47:12)
#13     main (file:///C:/Users/Zac/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/screenshots-2.1.1/bin/main.dart:122:25)
<asynchronous suspension>
#14     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
SaloGala commented 4 years ago

I had the same issue and was about to duplicate it.

After disconnecting my physical device screenshots tool started working fine.

So thank you!

mmcc007 commented 4 years ago

@zacps Should be ignoring any physical devices not specified in config file. Looks like flutter daemon is having a problem starting the emulator. Try running with the -v option and provide your config file.