Android: fix avdManager sdk parsing of android-Q to android-29

Some of latest system-images have SDK version as android-Q instead of
android-29, this will return an error because currect implementation
looks only for integers.

Task-number: QTCREATORBUG-23284
Change-Id: Ied6663110169edb2a5488b2724d1fa4e46131da6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2020-01-08 10:42:57 +02:00
parent 8a8efbd60d
commit 88edfdb1b2

View File

@@ -69,12 +69,15 @@ using SdkCmdFutureInterface = QFutureInterface<AndroidSdkManager::OperationOutpu
int platformNameToApiLevel(const QString &platformName) int platformNameToApiLevel(const QString &platformName)
{ {
int apiLevel = -1; int apiLevel = -1;
QRegularExpression re("(android-)(?<apiLevel>[0-9]{1,})", QRegularExpression re("(android-)(?<apiLevel>[0-9Q]{1,})",
QRegularExpression::CaseInsensitiveOption); QRegularExpression::CaseInsensitiveOption);
QRegularExpressionMatch match = re.match(platformName); QRegularExpressionMatch match = re.match(platformName);
if (match.hasMatch()) { if (match.hasMatch()) {
QString apiLevelStr = match.captured("apiLevel"); QString apiLevelStr = match.captured("apiLevel");
apiLevel = apiLevelStr.toInt(); if (apiLevelStr == 'Q')
apiLevel = 29;
else
apiLevel = apiLevelStr.toInt();
} }
return apiLevel; return apiLevel;
} }