Update status messages when unsupported devices are detected by the tools
diff --git a/packages/flutter_tools/lib/src/commands/devices.dart b/packages/flutter_tools/lib/src/commands/devices.dart index 817c9eb..9a8bd99 100644 --- a/packages/flutter_tools/lib/src/commands/devices.dart +++ b/packages/flutter_tools/lib/src/commands/devices.dart
@@ -30,10 +30,8 @@ printStatus('${devices.length} connected ${pluralize('device', devices.length)}:'); for (Device device in devices) { - printStatus('\t${_supportIndicator(device)}: ${device.name} (${device.id})'); - if (!device.isSupported()) { - printStatus("\t\t${device.supportMessage()}"); - } + String supportIndicator = device.isSupported() ? '' : '- unsupported'; + printStatus('${device.name} (${device.id}) ${supportIndicator}'); } } @@ -41,6 +39,4 @@ } } -String _supportIndicator(Device device) => device.isSupported() ? "[✔] Supported" : "[✘] Unsupported"; - String pluralize(String word, int count) => count == 1 ? word : word + 's';
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index 10a7f1f..e73f03d 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -17,6 +17,7 @@ import '../runner/flutter_command.dart'; import '../toolchain.dart'; import 'apk.dart'; +import 'devices.dart'; import 'install.dart'; import 'stop.dart'; @@ -173,6 +174,7 @@ } bool startedSomething = false; + int unsupportedCount = 0; for (Device device in devices.all) { ApplicationPackage package = applicationPackages.getPackageForPlatform(device.platform); @@ -180,7 +182,8 @@ continue; if (!device.isSupported()) { - printStatus("Skipping unsupported device: ${device.name}"); + printStatus("Skipping unsupported device '${device.name}'. ${device.supportMessage()}"); + unsupportedCount++; continue; } @@ -220,7 +223,14 @@ } if (!startedSomething) { - printError('Unable to run application. Please ensure that a supported device/simulator is connected.'); + int connected = devices.all.where((device) => device.isConnected()).length; + String message = 'Unable to run application'; + if (connected == 0) { + message += ' - no connected devices.'; + } else if (unsupportedCount != 0) { + message += ' - $unsupportedCount unsupported ${pluralize('device', unsupportedCount)} connected'; + } + printError(message); } return startedSomething ? 0 : 2;