From 803fb4ce77d5b75a9cb542e6bd160f5396269d65 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 21 Dec 2022 16:46:11 +0100 Subject: [PATCH] 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: Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidbuildapkstep.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 918a4e39770..4d03613bed1 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -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) { diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 4b6ab55d4df..1823462382c 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -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(); cmd.addArg("-DANDROID_NDK:PATH=" + ndkLocation.path());