Replace ANDROID_NATIVE_API_LEVEL with ANDROID_PLATFORM

ANDROID_NATIVE_API_LEVEL is not handled by the android toolchain files
starting the NDK version r23b. We should set ANDROID_PLATFORM instead,
to specify the NDK platform version, that exists in all NDK versions
supported by Qt. Also the ANDROID_PLATFORM variable expects the
'android-xx' format as a value, so avoid cutting the 'android-' prefix
when adding the value to the CMake configure string.

Fixes: QTCREATORBUG-28624
Change-Id: Idd4ba472e46982162e5ad74e9fc6868e50e3b434
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Alexey Edelev
2022-12-21 16:46:11 +01:00
parent 01a4f47781
commit 803fb4ce77
2 changed files with 2 additions and 2 deletions

View File

@@ -917,7 +917,7 @@ QVariant AndroidBuildApkStep::data(Utils::Id id) const
if (id == Constants::AndroidNdkPlatform) {
if (auto qtVersion = QtKitAspect::qtVersion(kit()))
return AndroidConfigurations::currentConfig()
.bestNdkPlatformMatch(AndroidManager::minimumSDK(target()), qtVersion).mid(8);
.bestNdkPlatformMatch(AndroidManager::minimumSDK(target()), qtVersion);
return {};
}
if (id == Constants::NdkLocation) {

View File

@@ -1477,7 +1477,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
if (DeviceTypeKitAspect::deviceTypeId(k) == Android::Constants::ANDROID_DEVICE_TYPE) {
buildSteps()->appendStep(Android::Constants::ANDROID_BUILD_APK_ID);
const auto &bs = buildSteps()->steps().constLast();
cmd.addArg("-DANDROID_NATIVE_API_LEVEL:STRING="
cmd.addArg("-DANDROID_PLATFORM:STRING="
+ bs->data(Android::Constants::AndroidNdkPlatform).toString());
auto ndkLocation = bs->data(Android::Constants::NdkLocation).value<FilePath>();
cmd.addArg("-DANDROID_NDK:PATH=" + ndkLocation.path());