From 9c1aba2abe4127e6ff2d797413f82faf03f8515b Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Mon, 1 May 2017 10:10:16 -0700 Subject: [PATCH] Skip adb server restarts during device discovery (#9693) --- .../lib/src/android/android_device.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart index cb31516bc2..779e589630 100644 --- a/packages/flutter_tools/lib/src/android/android_device.dart +++ b/packages/flutter_tools/lib/src/android/android_device.dart @@ -64,12 +64,14 @@ class AndroidDevice extends Device { // `adb shell getprop` result as UTF8. final ProcessResult result = await processManager.run( propCommand, - stdoutEncoding: LATIN1 + stdoutEncoding: LATIN1, + stderrEncoding: LATIN1, ).timeout(const Duration(seconds: 5)); if (result.exitCode == 0) { _properties = parseAdbDeviceProperties(result.stdout); } else { - printError('Error retrieving device properties for $name.'); + printError('Error retrieving device properties for $name:'); + printError(result.stderr); } } on TimeoutException catch (_) { throwToolExit('adb not responding'); @@ -515,6 +517,7 @@ List getAdbDevices({ String mockAdbOutput }) { if (mockAdbOutput == null) { final String adbPath = getAdbPath(androidSdk); + printTrace('Listing devices using $adbPath'); if (adbPath == null) return []; text = runSync([adbPath, 'devices', '-l']); @@ -533,6 +536,12 @@ List getAdbDevices({ String mockAdbOutput }) { if (line.startsWith('* daemon ')) continue; + // Skip lines about adb server and client version not matching + if (line.startsWith('adb server version')) { + printStatus(line); + continue; + } + if (line.startsWith('List of devices')) continue;