Privacy policyContactsAbout siteOpinionsGitHubDonate
© EVILEG 2015-2018
Recommend hosting

QML - Lesson 020. Introduction to Android Manifest in Qt Creator

Qt, QML, Android, Android Manifest, manifest

When it comes time to lead the development of Android on Qt, this is sooner or later we arrive at the need to work with the file AndroidManifest.xml. In this file, we have the ability to specify certain basic settings for the behavior of our application, such as the orientation of the screen, or the main theme of the application.

But the default Android Manifest in Qt Creator is not created. To start working with him, it will be necessary to create it in the project build options.

Step by step with the Android Manifest

First step

To do this, go to the Projects tab and in it we find the necessary assembly kit. Select Build, and in it find item Collect Android APK. Razvernёm this item by clicking on the "Read More".

Here you can select the target level of the SDK and configure APK building.

Second step

But to create the AndroidManifest.xml file, you will need to click on the button "Create a template." And then select the folder where the Android Manifest will be created.

The third step

The project structure you see AndroidManifest.xml file. And the right of the structure is open setup of the file. Here you can set the minimum required device SDK, on which the installation is carried out, as well as set the icon of the application and include the required permissions for the application. For example, calls, internet access, work with Wi-Fi, etc.

fourth step

After you set up the basic parameters of the application, I propose to look at himself xml file code that generated QtCreator. This code will be similar to the code that you see in AndroidManifst.xml when developing an application for Android in Java. Therefore, setting the file will be similar to the development of a Java. And, for example, setting fikisrovannoy orientation of the screen will look as follows:

android:screenOrientation="landscape" >

Well, the full code of the resulting Android Manifest I looked like this.

<?xml version="1.0"?>
<manifest package="org.qtproject.example" xmlns:android="" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
    <application android:hardwareAccelerated="true" android:name="" android:label="-- %%INSERT_APP_NAME%% --">
        <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop">
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            <meta-data android:name="" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
            <meta-data android:name="" android:resource="@array/qt_sources"/>
            <meta-data android:name="" android:value="default"/>
            <meta-data android:name="" android:resource="@array/qt_libs"/>
            <meta-data android:name="" android:resource="@array/bundled_libs"/>
            <!-- Deploy Qt libs as part of package -->
            <meta-data android:name="" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
            <meta-data android:name="" android:resource="@array/bundled_in_lib"/>
            <meta-data android:name="" android:resource="@array/bundled_in_assets"/>
            <!-- Run with local libs -->
            <meta-data android:name="" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
            <meta-data android:name="" android:value="/data/local/tmp/qt/"/>
            <meta-data android:name="" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
            <meta-data android:name="" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
            <meta-data android:name="" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
            <!--  Messages maps -->
            <meta-data android:value="@string/ministro_not_found_msg" android:name=""/>
            <meta-data android:value="@string/ministro_needed_msg" android:name=""/>
            <meta-data android:value="@string/fatal_error_msg" android:name=""/>
            <!--  Messages maps -->

            <!-- Splash screen -->
            <meta-data android:name="" android:resource="@drawable/logo"/>
            <!-- Splash screen -->

            <!-- Background running -->
            <!-- Warning: changing this value to true may cause unexpected crashes if the
                          application still try to draw after
                          signal is sent! -->
            <meta-data android:name="" android:value="false"/>
            <!-- Background running -->
    <uses-sdk android:targetSdkVersion="14"/>
    <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>

    <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
         Remove the comment if you do not require these default permissions. -->

    <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
         Remove the comment if you do not require these default features. -->
    <!-- %%INSERT_FEATURES -->



Working with Qt under AndroidManifest.xml has its own specifics, but it's still not so very different from that as if we were developing in Java.

You can also look profile project. In it you'll see how the project is connected to your Android Manifest.


Only authorized users can post comments.
Please, Log in or Sign up
Jan. 13, 2019, 8:35 p.m.
Мария Канева

C++ - Test 005. Structures and Classes

  • Result:91points,
  • Rating points8
Jan. 13, 2019, 8:32 p.m.
Мария Канева

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:70points,
  • Rating points1
Jan. 13, 2019, 8:28 p.m.
Мария Канева

C++ - Тест 003. Условия и циклы

  • Result:78points,
  • Rating points2
Last comments
Jan. 16, 2019, 8:06 a.m.

Заработало. Забыл model->select(); вписать.
Jan. 16, 2019, 8:02 a.m.

Всё равно пусто, хотя строка с данными в базу добавляется.
Jan. 16, 2019, 7:51 a.m.
Евгений Легоцкой

потому, что нужно сохранять информацию для всех остальных ролей и столбцов через вызов переопределённого метода. Да к тому же вы ещё и зациклили вызов метода data. QVariant MySqlTableModel:...
Jan. 16, 2019, 7:43 a.m.

Сделал вот так. В tableView ничего нет, кроме заголовка. QVariant MySqlTableModel::data(const QModelIndex &index, int role) const{ if (role == Qt::DisplayRole) { QTime ...
Now discuss on the forum
Jan. 16, 2019, 4:43 p.m.

Здравствуйте.Сделал Sleep в приложении так: QApplication::processEvents(); QThread::sleep(TimeSleep); На компьютере работает прекрасно.Но на андройде работает не прав...
Jan. 15, 2019, 4:53 p.m.

Спасибо, заработало.Но выдало обычный текст без форатирования HTML.Придется искать дальше
Jan. 15, 2019, 12:52 p.m.

Я же вам выше написал CLion умеет работать с ремоут машинами. И Qt так же собирает.
Jan. 14, 2019, 2:27 p.m.
Павел Богдевич

Join us in social networks

For registered users on the site there is a minimum amount of advertising