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 <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Petri Virkkunen
2022-09-13 09:24:25 +03:00
parent 502e94cbe9
commit 1c2ffde787
2 changed files with 9 additions and 4 deletions

View File

@@ -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;

View File

@@ -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