- Qt 6.8
- Android Platform Notes
- Qt 6.8.3 Reference Documentation

Supporting Google Emoji Font Policy ◦ Android GNU C++ Run-time Licensing

# Android Platform Notes

This page contains information particular to building and running Qt applications on Android. See Supported Android Versions for what Android versions and API levels are supported.

## Plugins and Imports Special Considerations

If an application uses plugins that depend on other modules, these modules must be listed in the application's dependencies. For more information, see Dependencies Detection.

### Qt GUI Dependency

Given that Android apps typically include GUI elements, the Qt for Android plugin is built mainly to provide a GUI, so it implements the various QPA abstractions. As a result, deploying a Qt for Android app is expected to involve a dependency on Qt GUI. Moreover, it's worth noting that Qt Creator only supports Gradle builds and deployments, meaning that command line or shell executions are not supported out of the box.

## OpenGL Special Considerations

Modern devices often support OpenGL ES 3.0 or 3.1 in addition to 2.0. To get a suitable OpenGL context, set the requested version via QSurfaceFormat::setVersion().

Note: Using OpenGL ES 3.x features will result in the application breaking on older devices that only support 2.0.

## Known Issues

### Predictive Text

Due to a bug on some devices, when you turn off predictive text with `ImhNoPredictiveText`, this property is ignored and predictive text is still enabled. To work around this, set the `QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT` environment variable to `1`. However, one side effect is that this environment variable can cause a problem with other keyboards such as Gboard. If you use a language like Japanese, with Gboard, only a QWERTY keyboard is displayed. This environment variable is queried each time the keyboard is displayed, so it's possible to toggle the workaround on and off, as necessary.

### Display Cutout Modes

Android LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES is not supported. For more information, see QTBUG-114437.

### Text Glyph Caching

Because of a bug in some OpenGL drivers, the mechanism used by Qt to cache text glyphs does not work as expected on all Android devices, causing text to appear scrambled. To remedy this, a workaround is in place, but it can increase memory consumption and can also affect text rendering performance. The workaround is now used by default on all devices.

You can disable the workaround by setting the `QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND` environment variable to 1 or true. However, you should do so only after verifying that text appears correctly on all targeted devices.

## Limitations

Some of the Qt modules might have features that are not supported on Android or have limitations. For more information, see QTBUG-72086.

## Frequently Asked Questions

- Should I use `QtActivity` or Android Activity to create a custom Activity?

  `QtActivity` extends `Activity` and implements the logic needed to load the Qt libraries or handle events and native calls between Android and Qt. In general, extending `QtActivity` is needed if you are using any native calls. Otherwise, extending `Activity` should work.

- Should I use `QtService` or Android Service?

  The same reasoning as `QtActivity` applies here. Unless you are using features that require the Qt libraries to be loaded, like native calls.

- Can Android Fragments be used with Qt? What is the equivalent for Fragment in Qt?

  Android Fragments cannot be used with Qt. However, Qt offers it's own modular components and views with QML. You can combine multiple components in one QML view. For more information, see Qt Qml.

Supporting Google Emoji Font Policy ◦ Android GNU C++ Run-time Licensing