The Android Manifest is an XML file necessary for any Android app. It contains app configuration for different settings and features that the app use, as well as details on the app itself, such as, package name, app name, version, etc. Permissions and hardware features can also be set from the manifest.
Qt for Android maintains a version of AndroidManifest.xml
with default configuration that include features, permissions and other configuration used by the build system which are needed for building and running
Qt apps on Android.
Qt defines some meta-data that is passed from the build systems and to androiddeployqt which
populates the manifest with the correct values without explicitly setting these in the manifest file. Such meta-data is assigned a value in the
form "-- %%INSERT_VALUE%% --"
, for example:
<manifest ... android:versionCode="-- %%INSERT_VERSION_CODE%% --" ... </manifest>
This would be populated with the version code that is set in, for example, CMake
.
Qt sets the following manifest configuration by default:
Section | Option | Description |
---|---|---|
<manifest> | package | Sets the package name. Default: org.qtproject.example.app_name . |
android:installLocation |
Sets the app's installation location, whether internal or external storage. Default: auto . |
|
android:versionCode | Sets the internal version code. Populated from ANDROID_VERSION_CODE (qmake) and QT_ANDROID_VERSION_CODE (CMake). Default: 1 . |
|
android:versionName | Sets the public version name. Populated from ANDROID_VERSION_NAME (qmake) and QT_ANDROID_VERSION_NAME (CMake). Default: 1.0 . |
|
<supports-screens> |
Sets the screen sizes that the app supports, default values are anyDensity , largeScreens , normalScreens , and smallScreens . |
|
<application> | android:name | The application class name. Default: org.qtproject.qt.android.bindings.QtApplication . |
android:label | The application name label. Default: the Qt project's target name. | |
android:extractNativeLibs | Extracts the native C++ libraries on installation. Default: true . |
|
android:hardwareAccelerated | Sets hardware acceleration preference. Default: true . |
|
android:requestLegacyExternalStorage | Whether to use Android scoped storage. Default true . |
|
<activity> | android:name | The activity class name. Default: org.qtproject.qt.android.bindings.QtActivity . |
android:label | The activity name label. Default: the Qt project's target name. | |
android:configChanges | Lists configuration changes that the activity handles. Default: orientation , uiMode , screenLayout , screenSize , smallestScreenSize ,
layoutDirection , locale , fontScale , keyboard , keyboardHidden , navigation , mcc , mnc , density . |
|
android:launchMode | The method used to launch the activity. Default: singleTop . |
|
android:screenOrientation | The orientation of the activity's display on the device. Default: unspecified . |
|
<intent-filter> |
Specifies the types of intents that the activity can respond to. Default:
<action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> |
|
In addition to the default manifest configuration that Qt sets, Qt defines some meta-data that is valid for Qt apps only. Such meta-data is usually under the <activity>
section in the form:
<meta-data android:name="meta-data-name" android:value="meta-data-value" />
The following is a list of such meta-data defined by Qt:
meta-data name | Description |
---|---|
android.app.lib_name |
The filename of the native C++ library that is used by the activity.
Note: This attribute is mandatory and shouldn't be removed. Default: the Qt project's target name. |
android.app.extract_android_style |
The method used to extract the native Android Style information. For more information, see Style Extraction. Default: minimal .
|
android.app.background_running |
Sets whether the app keeps running tasks in the background. Setting this to true is the equivalent of setting the environment variable QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED to 0 .
Default: false .
Warning: Setting this to |
android.app.arguments | Sets a list of arguments to pass to the app "arg1 arg2" . Populated from ANDROID_APPLICATION_ARGUMENTS (qmake) and QT_ANDROID_APPLICATION_ARGUMENTS (CMake). Default: not set. |
android.app.splash_screen_drawable_portrait | Sets a drawable for a splash screen specific to portrait mode. For example: android:resource="@drawable/splash_portrait" . Default: not set. |
android.app.splash_screen_drawable_landscape | Sets a drawable for a splash screen specific to landscape mode. For example: android:resource="@drawable/splash_landscape" . Default: not set. |
android.app.splash_screen_drawable |
Sets a drawable for a splash screen at the start of the app.
Note: Orientation specific splash screens are checked first, if not set, this is used instead. For example: |
android.app.splash_screen_sticky |
Sets whether the splash screen stays visible until explicitly hidden by the app. For more information, see QAndroidApplication::hideSplashScreen(). Default: false .
|
android.app.system_libs_prefix | Specifies a custom system library path to use for library loading lookup. This is necessary when running as a system app. Default: /system/lib/ . |
Some meta-data attributes can also be used in Services. The main ones are:
Different Qt modules might require some Android permissions or features to function properly, for example, Camera permission in QtMultimedia. The androiddeployqt tool takes care of including such requirements into the Android manifest during the build. Qt defines the following lines into the manifest, which they get replaced by the actual values:
<manifest ... <!-- %%INSERT_PERMISSIONS --> <!-- %%INSERT_FEATURES --> ... </manifest>
Note: If those lines are removed from the project manifest, Qt won't be able to include the correct permissions. So some functionalities might not work properly.
Qt uses different methods to determine how Qt Widgets and Qt Quick Controls should be styled:
default
or full
: when using Qt Widgets or Qt Quick Controls 1.
Note: This method uses some Android non-SDK interfaces, that are being restricted and removed by Google starting from Android 9.0 (API 28). For that reason, this is not recommended for Android 9.0 or greater.
minimal
: when using Qt Quick Controls 2 and no Qt Widgets or Qt Quick Controls 1. This is faster than using the default or full options.none
: no style extraction.Versions of Qt earlier than 6.2 used to have an additional set of meta-data defined by Qt. These attributes used to manage dependencies and some were used by the discontinued Ministro
service. With Qt 6.2, they
should be removed. Here is a list of these attributes:
For more information on the Android Manifest, see Android App Manifest.