From cae4dd01a8a5445d1b2815a22ff318eb2976ca48 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Fri, 12 May 2023 01:22:07 +0300 Subject: [PATCH] Android: Skip "Build APK" for non-app builds For projects using Qt 5.15 and Qt 6, the deployment settings file is generated by CMake/qmake and not Qt Creator, so if such file doesn't exist or it's been generated by Qt Creator, we can assume the project is not an android app. This is mainly a workaround for now to avoid a more involved fix which would need to potentially remove the method AndroidManager::deploymentSettings() (and it's use cases) which is used to generate a minimal version of deployment settings file, which was added some time ago where the build system CMake and Qt wasn't handling that generation, but now with Qt 5.15 and Qt 6, that shouldn't be a concern of Qt Creator. Fixes: QTCREATORBUG-27167 Fixes: QTBUG-111334 Task-number: QTCREATORBUG-26888 Change-Id: I15657f3b67acc52c28c92e6af24668f778432a19 Reviewed-by: Alessandro Portale --- src/plugins/android/androidmanager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 0ccca7c8f7b..78b6202a65c 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -361,6 +361,14 @@ Abi AndroidManager::androidAbi2Abi(const QString &androidAbi) bool AndroidManager::skipInstallationAndPackageSteps(const Target *target) { + // For projects using Qt 5.15 and Qt 6, the deployment settings file + // is generated by CMake/qmake and not Qt Creator, so if such file doesn't exist + // or it's been generated by Qt Creator, we can assume the project is not + // an android app. + const FilePath inputFile = AndroidQtVersion::androidDeploymentSettings(target); + if (!inputFile.exists() || AndroidManager::isQtCreatorGenerated(inputFile)) + return true; + const Project *p = target->project(); const Core::Context cmakeCtx = Core::Context(CMakeProjectManager::Constants::CMAKE_PROJECT_ID);