Android: fix problem with release package for cmake based builds

After 9efaf8bae914958a09d29a4cdbf62e345f3e6369 commit there was no
possibility to create release package for cmake based builds.
The new cmake variable (QT_ANDROID_DEPLOY_RELEASE) was already added to
allow turning on release build manually

This commit sets the --release flag automatically for androiddeployqt
tool for Release, RelWithDebInfo and MinSizeRel build types.

The --release flag is not set automatically if QT_BUILD_TESTS variable
is set. This is the workaround for tests. Release package need to be
signed. Signing is currently not supported by CI. What is more, also
androidtestrunner is not working on release APKs.

Fixes: QTBUG-112921
Fixes: QTBUG-108132
Task-number: COIN-882
Pick-to: 6.5
Change-Id: Ia81465f4a0f0e5b8dfa50c44028658f7a2346c1a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Bartlomiej Moskal 2023-04-28 11:49:06 +02:00
parent 433d67e767
commit a273ea7f41

View File

@ -430,6 +430,13 @@ function(qt6_android_add_apk_target target)
endif()
if(QT_ANDROID_DEPLOY_RELEASE)
list(APPEND extra_args "--release")
elseif(NOT QT_BUILD_TESTS)
# Workaround for tests: do not set automatically --release flag if QT_BUILD_TESTS is set.
# Release package need to be signed. Signing is currently not supported by CI.
# What is more, also androidtestrunner is not working on release APKs,
# For example running "adb shell run-as" on release APK will finish with the error:
# run-as: Package '[PACKAGE-NAME]' is not debuggable
list(APPEND extra_args $<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>:--release>)
endif()
_qt_internal_check_depfile_support(has_depfile_support)