forked from qt-creator/qt-creator
Android: Make api level M known
If we can't convert the string to an int value, than we are going to read the settings file. If that fails, we fallback to string comparation. Task-number: QTCREATORBUG-14537 Change-Id: I0c4c5811f246ef1835c80837879d815cfa27b5d7 Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
committed by
BogDan Vatra
parent
8e2370638a
commit
2a049708e7
@@ -61,6 +61,7 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
|
||||
// Target sdk combobox
|
||||
int minApiLevel = 9;
|
||||
QStringList targets = AndroidConfig::apiLevelNamesFor(AndroidConfigurations::currentConfig().sdkTargets(minApiLevel));
|
||||
targets.removeDuplicates();
|
||||
m_ui->targetSDKComboBox->addItems(targets);
|
||||
m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::buildTargetSDK(step->target())));
|
||||
|
||||
|
@@ -176,6 +176,24 @@ namespace {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Some preview sdks use a non integer version
|
||||
int apiLevelFromAndroidList(const QString &string)
|
||||
{
|
||||
bool ok;
|
||||
int result = string.toInt(&ok);
|
||||
if (ok)
|
||||
return result;
|
||||
Utils::FileName sdkLocation = AndroidConfigurations::currentConfig().sdkLocation();
|
||||
sdkLocation.appendPath(QLatin1String("/platforms/android-") + string + QLatin1String("/source.properties"));
|
||||
result = QSettings(sdkLocation.toString(), QSettings::IniFormat).value(QLatin1String("AndroidVersion.ApiLevel")).toInt(&ok);
|
||||
if (ok)
|
||||
return result;
|
||||
if (string == QLatin1String("L"))
|
||||
return 21;
|
||||
if (string == QLatin1String("MNC"))
|
||||
return 22;
|
||||
return 23; // At least
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -397,7 +415,8 @@ void AndroidConfig::updateAvailableSdkPlatforms() const
|
||||
if (index == -1)
|
||||
continue;
|
||||
QString androidTarget = line.mid(index + 1, line.length() - index - 2);
|
||||
platform.apiLevel = androidTarget.mid(androidTarget.lastIndexOf(QLatin1Char('-')) + 1).toInt();
|
||||
const QString tmp = androidTarget.mid(androidTarget.lastIndexOf(QLatin1Char('-')) + 1);
|
||||
platform.apiLevel = apiLevelFromAndroidList(tmp);
|
||||
} else if (line.startsWith(QLatin1String("Name:"))) {
|
||||
platform.name = line.mid(6);
|
||||
} else if (line.startsWith(QLatin1String("Tag/ABIs :"))) {
|
||||
@@ -724,10 +743,7 @@ QVector<AndroidDeviceInfo> AndroidConfig::androidVirtualDevices(const QString &a
|
||||
if (lastIndex == -1) // skip line
|
||||
break;
|
||||
QString tmp = line.mid(lastIndex).remove(QLatin1Char(')')).trimmed();
|
||||
if (tmp == QLatin1String("L")) // HACK for android-L preview
|
||||
dev.sdk = 20;
|
||||
else
|
||||
dev.sdk = tmp.toInt();
|
||||
dev.sdk = apiLevelFromAndroidList(tmp);
|
||||
}
|
||||
if (line.contains(QLatin1String("Tag/ABI:"))) {
|
||||
int lastIndex = line.lastIndexOf(QLatin1Char('/')) + 1;
|
||||
|
@@ -281,7 +281,7 @@ QString AndroidManager::loadLocalJarsInitClasses(ProjectExplorer::Target *target
|
||||
|
||||
QPair<int, int> AndroidManager::apiLevelRange()
|
||||
{
|
||||
return qMakePair(9, 21);
|
||||
return qMakePair(9, 22);
|
||||
}
|
||||
|
||||
QString AndroidManager::androidNameForApiLevel(int x)
|
||||
|
Reference in New Issue
Block a user