[flutter_tools] handle null value from sdk version (#52351)

When the AndroidDevice checks for the current API version, it isn't handling a null response. While we can refuse to run on API levels that are unsupported, we should probably assume that a null response = lowest possible API level and allow these to run.
This commit is contained in:
Jonah Williams
2020-03-10 14:23:18 -07:00
committed by GitHub
parent 605debfcff
commit 5d289721fc
2 changed files with 137 additions and 2 deletions

View File

@@ -319,9 +319,11 @@ class AndroidDevice extends Device {
throwOnError: true,
);
// This has been reported to return null on some devices. In this case,
// assume the lowest supported API to still allow Flutter to run.
// Sample output: '22'
final String sdkVersion = await _getProperty('ro.build.version.sdk');
final String sdkVersion = await _getProperty('ro.build.version.sdk')
?? minApiLevel.toString();
final int sdkVersionParsed = int.tryParse(sdkVersion);
if (sdkVersionParsed == null) {