be more lenient when looking for matching android sdk components (#3830)
* be more lenient when looking for matching android sdk components
* use a null aware operator
diff --git a/packages/flutter_tools/lib/src/android/android_sdk.dart b/packages/flutter_tools/lib/src/android/android_sdk.dart
index c21676b..d16a4cf 100644
--- a/packages/flutter_tools/lib/src/android/android_sdk.dart
+++ b/packages/flutter_tools/lib/src/android/android_sdk.dart
@@ -147,10 +147,7 @@
.toList();
}
- // Here we match up platforms with cooresponding build-tools. If we don't
- // have a match, we don't return anything for that platform version. So if
- // the user only has 'android-22' and 'build-tools/19.0.0', we don't find
- // an Android sdk.
+ // Match up platforms with the best cooresponding build-tools.
_sdkVersions = platforms.map((String platformName) {
int platformVersion;
@@ -167,6 +164,8 @@
return version.major == platformVersion;
}).toList());
+ buildToolsVersion ??= Version.primary(buildTools);
+
if (buildToolsVersion == null)
return null;