- Qt 6.8
- Qt Quick for Android
- Qt 6.8.2 Reference Documentation

# Qt Quick for Android

## Qt Quick for Android overview

The basis of this approach is to offer Qt QML APIs in an embedded way so that the app will remain a relatively typical Android app. This approach offers a more standard Android-centered approach at the cost of leveraging the cross-platform nature of a Qt application. It's best suited for adding desirable Qt features to an existing Android application.

- Android creates the Qt content and controls it.
- Android Studio with the Qt Tools for Android Studio plugin is used for development.
- For Qt content, Qt Creator or Qt Design Studio are used.
- Main languages are Java and Kotlin, with QML used for specific parts such as 3D content.
- You can use any Android APIs you want, but you can use JNI if you want more control over communication between your Java code and QML. See QJniObject and QJniEnvironment.

### How this differs from Qt for Android

The most prominent difference between these approaches is the project structure. Qt for Android applications are CMake projects that can be built for Android or other platforms, while a Qt Quick for Android Project is an Android project that includes QML content and can only be built for Android.

The main objective of the Qt for Android approach is to let Qt handle most of the work of the architecture and boilerplate code of the app and let you focus on the content. It offers a complete and reliable cross-platform approach.

- Qt creates and controls the Android app.
- Qt Creator, Qt Design Studio, or Visual Studio can be used.
- Main languages are C++ and QML.
- Android specifics are more hidden; Qt handles these internally.
- To use Android APIs not yet available as Qt APIs, you must use JNI. See QJniObject and QJniEnvironment.

See How Qt for Android Works for further details on Qt for Android's architecture.

## How Qt Quick for Android works

Qt Quick for Android offers you Android APIs that enable you to insert QML content as an Android View in your project.

## APIs

These are the public Java and Kotlin APIs that you will use in an Android app to embed QML.

- Qt Quick View Android Class
- QtAbstractItemModel Android Class
- QtAbstractListModel Android Class
- interface QtQmlStatusChangeListener (which uses the QtQmlStatus enum)
- QtModelIndex Android Class

To use these classes, you must include the following in your `build.gradle` file:

     packagingOptions.jniLibs.useLegacyPackaging true

Note: See the QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS CMake variable for further information on Java code generation of QML components.

## API examples

- Qt Quick for Android Studio Projects
- Exposing QtAbstractListModel to QML
- Using QtAbstractItemModel in Android Studio Projects

## Tooling

The Qt Gradle Plugin and Qt Tools for Android Studio plugin are provided by Qt for easy development. You can use the Gradle Plugin independently from an IDE as part of your build toolchain. Qt Tools for Android Studio uses the plugin to build your projects in Android Studio.