From 29a793f3ffb6d84c1ff25c0726a93e70c63d5090 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Fri, 13 Dec 2024 14:45:47 +0200 Subject: [PATCH] Android: handle quotes in hard-coded namespace in build.gradle Remove quotes from the namespace values if they're set directly to build.gradle. Fixes: QTBUG-132150 Change-Id: I7f5e132c2600bf5079850c99dc500b1dff7e6a96 Reviewed-by: Ivan Solovev (cherry picked from commit 60f78212379ba2b4a7a9bfadc5088a60309e923c) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 440dcaca27d28259276f8271d0abf059f04ccca7) --- src/tools/androiddeployqt/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 72dce2e2977..1a298614a87 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -800,7 +800,14 @@ GradleBuildConfigs gradleBuildConfigs(const QString &path) } else if (trimmedLine.contains("compileSdkVersion androidCompileSdkVersion.toInteger()")) { configs.usesIntegerCompileSdkVersion = true; } else if (trimmedLine.contains("namespace")) { - configs.appNamespace = QString::fromUtf8(extractValue(trimmedLine)); + const QString value = QString::fromUtf8(extractValue(trimmedLine)); + const bool singleQuoted = value.startsWith(u'\'') && value.endsWith(u'\''); + const bool doubleQuoted = value.startsWith(u'\"') && value.endsWith(u'\"'); + + if (singleQuoted || doubleQuoted) + configs.appNamespace = value.mid(1, value.length() - 2); + else + configs.appNamespace = value; } }