From 1c2ffde787fb7bcd15f0fd5091fc8cb3652077d5 Mon Sep 17 00:00:00 2001 From: Petri Virkkunen Date: Tue, 13 Sep 2022 09:24:25 +0300 Subject: [PATCH] Android: set release flag when building and deploying apk ...in Release builds Signed Release builds are now deployed correctly by giving androiddeployqt the --release flag during the Deployment step for Release builds. Unsigned Release apks are now correctly built under the release directory by giving androiddeployqt the --release flag during the Build step for Release builds instead of determining build type from whether or not the package is signed. Fixes: QTCREATORBUG-28163 Change-Id: I319bc95325c88fb84a5997c9237df65eb7983c0e Reviewed-by: Alessandro Portale Reviewed-by: Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidbuildapkstep.cpp | 10 ++++++---- src/plugins/android/androiddeployqtstep.cpp | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 868e7e4129d..75df1b3b0ff 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -608,14 +608,16 @@ bool AndroidBuildApkStep::init() if (m_buildAAB) arguments << "--aab" << "--jarsigner"; + if (buildType() == BuildConfiguration::Release) { + arguments << "--release"; + } + QStringList argumentsPasswordConcealed = arguments; if (m_signPackage) { - arguments << "--release" - << "--sign" << m_keystorePath.toString() << m_certificateAlias + arguments << "--sign" << m_keystorePath.toString() << m_certificateAlias << "--storepass" << m_keystorePasswd; - argumentsPasswordConcealed << "--release" - << "--sign" << "******" + argumentsPasswordConcealed << "--sign" << "******" << "--storepass" << "******"; if (!m_certificatePasswd.isEmpty()) { arguments << "--keypass" << m_certificatePasswd; diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index e5bde4a30b7..beeb851118f 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -261,6 +261,9 @@ bool AndroidDeployQtStep::init() m_androiddeployqtArgs.addArg("--gradle"); + if (buildType() == BuildConfiguration::Release) + m_androiddeployqtArgs.addArgs({"--release"}); + if (androidBuildApkStep && androidBuildApkStep->signPackage()) { // The androiddeployqt tool is not really written to do stand-alone installations. // This hack forces it to use the correct filename for the apk file when installing