From 0de09fe3a3da4a0a74788644c66f8a41a252c07f Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 1 Nov 2021 17:19:43 +0100 Subject: [PATCH] Android: Enable manual adding of NDKs v22+ Don't enforce the presence of a "platforms" subdirectory if the NDK is of version 22 or higher. The last NDK version with that directory is 21. Change-Id: Ib431e7db4521533206304d252dcf93b7ea6169e5 Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidconfigurations.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 6377ee73ee1..25862d4fc1f 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -840,11 +840,23 @@ QStringList AndroidConfig::getAbis(const QString &device) bool AndroidConfig::isValidNdk(const QString &ndkLocation) const { auto ndkPath = Utils::FilePath::fromUserInput(ndkLocation); - const FilePath ndkPlatformsDir = ndkPath.pathAppended("platforms"); - return ndkPath.exists() && ndkPath.pathAppended("toolchains").exists() - && ndkPlatformsDir.exists() && !ndkPlatformsDir.toString().contains(' ') - && !ndkVersion(ndkPath).isNull(); + if (!ndkPath.exists()) + return false; + + if (!ndkPath.pathAppended("toolchains").exists()) + return false; + + const QVersionNumber version = ndkVersion(ndkPath); + if (ndkVersion(ndkPath).isNull()) + return false; + + const FilePath ndkPlatformsDir = ndkPath.pathAppended("platforms"); + if (version.majorVersion() <= 22 + && (!ndkPlatformsDir.exists() || ndkPlatformsDir.toString().contains(' '))) + return false; // TODO: Adapt code that assumes the presence of a "platforms" folder + + return true; } QString AndroidConfig::bestNdkPlatformMatch(int target, const BaseQtVersion *qtVersion) const