Qt for Android Environment Variables

Enabling or disabling workarounds

Qt Android uses some environment variables to enable/disable certain workarounds:

Commonly used variables

VariableDescription
QT_ANDROID_NO_EXIT_CALLIn some cases, an Android app might not be able to safely clean all threads while calling exit() and it might crash. This is because there are C++ threads running and destroying these without joining them terminates an application. These threads cannot be joined because it's not possible to know if they are running. This flag avoids calling exit() and lets the Android system handle this, at the cost of not attempting to run global destructors.
QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXTAllows the hiding of predictive text suggestions, mainly from password fields. Certain devices don’t handle this properly. For more information, see Predictive Text.
QT_ANDROID_ENABLE_RIGHT_MOUSE_FROM_LONG_PRESSInterprets a long touch press as a right mouse click event.
QT_ANDROID_DISABLE_ACCESSIBILITYDisable Accessibility. This prevents the processing of accessibility events.

Less commonly used variables

VariableDescription
QT_ANDROID_FONT_LOCATIONSets a custom path for system fonts.
QT_ANDROID_MAX_ASSETS_CACHE_SIZECache size for assets under the assets folder.
QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUNDSee Text Glyph Caching
QT_ANDROID_RASTER_IMAGE_DEPTH
QT_ANDROID_MINIMUM_MOUSE_DOUBLE_CLICK_DISTANCE
QT_ANDROID_BACKGROUND_ACTIONS_QUEUE_SIZEWhen an Android app is paused or inactive, it may continue to receive UI updates from components like a BroadcastReceiver or Service. These updates are queued until the app resumes. The queue can grow indefinitely, leading to extra memory usage and latency when processing these updates once the app is active again. This environment variable addresses this issue by introducing a size limit for the queue. Once the specified limit is reached, the oldest entry is discarded to add the newest entry, therefore preventing unbound growth. By default, the queue is unbound and this environment variable is not set. Additionally, if set to any negative number the queue remains unbound.

For example, QT_ANDROID_BACKGROUND_ACTIONS_QUEUE_SIZE=100 limits the queue to 100 actions.

Note: Though related, these are not the same as CMake commands or variables used by Qt For Android, see Qt for Android CMake Configuration

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.