Sophie

Sophie

distrib > Mageia > 6 > i586 > by-pkgid > f93881942bd3805980c2fe63aa853d78 > files > 194

qtdoc5-5.9.4-1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- platform-notes-android.qdoc -->
  <title>Platform and Compiler Notes - Android | Qt 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.9</a></td><td >Platform and Compiler Notes - Android</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<p class="naviNextPrevious headerNavi">
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#android-development-in-qt-creator">Android Development in Qt Creator</a></li>
<li class="level1"><a href="#application-package">Application Package</a></li>
<li class="level1"><a href="#deployment">Deployment</a></li>
<li class="level2"><a href="#deployment-with-ministro">Deployment with Ministro</a></li>
<li class="level2"><a href="#deployment-for-debugging">Deployment for Debugging</a></li>
<li class="level1"><a href="#plugins-and-imports-special-considerations">Plugins and Imports Special Considerations</a></li>
<li class="level1"><a href="#text-special-considerations">Text Special Considerations</a></li>
<li class="level1"><a href="#opengl-special-considerations">OpenGL Special Considerations</a></li>
<li class="level1"><a href="#multimedia-special-considerations">Multimedia Special Considerations</a></li>
<li class="level1"><a href="#assets-file-system">Assets File System</a></li>
<li class="level1"><a href="#supported-architectures">Supported Architectures</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Platform and Compiler Notes - Android</h1>
<span class="subtitle"></span>
<!-- $$$platform-notes-android.html-description -->
<div class="descr"> <a name="details"></a>
<p>This page contains information particular to building Qt applications for and running them on the <a href="android-support.html">Android</a> platform. Qt supports Android versions 4.1 (API level 16) or later.</p>
<a name="android-development-in-qt-creator"></a>
<h2 id="android-development-in-qt-creator">Android Development in Qt Creator</h2>
<p>The easiest way to develop with Qt for Android is to use <a href="http://doc.qt.io/qtcreator/creator-developing-android.html">Qt Creator</a>. When you apply a <b>Qt for Android Kit</b> to a Qt Creator project, it will create and maintain a set of files which are required to make your application run on Android.</p>
<p>The files added to your project are:</p>
<ul>
<li><i>.java</i> files will serve as the entry point into your application and automatically load Qt to execute the native code in your application</li>
<li><i>AndroidManifest.xml</i> which provides meta-information about your application</li>
<li>Other XML files detailing the dependencies of your application</li>
<li>Resource files</li>
<li>Depending on the deployment method selected in Qt Creator, additional files like libraries and QML files can be included in the project.</li>
</ul>
<p>Qt Creator adds these files in a subdirectory of your project called <b>android</b>. The contents of the <b>android</b> folder is used as basis for your app's distributable application package.</p>
<a name="application-package"></a>
<h2 id="application-package">Application Package</h2>
<p>On Android, apps are distributed in packages called <i>APK</i>. Qt Creator builds the <i>APK</i> for you, but if you for some reason want to do this manually, you must first make sure that the appropriate packaging and build files are in place. For more detailed information about how the packaging is done, see <a href="deployment-android.html">Deploying an Application on Android</a>.</p>
<a name="deployment"></a>
<h2 id="deployment">Deployment</h2>
<p>Qt Creator currently supports three methods of deployment for Android apps: the default deployment method is suitable for distribution of the APK file. With this deployment method, the necessary Qt libraries and files will be copied into your project directory, and bundled as part of the APK, so that you get a stand-alone, distributable application package.</p>
<a name="deployment-with-ministro"></a>
<h3 >Deployment with Ministro</h3>
<p>The second method is suitable if you want to minimize the size of your APK, and can be selected by opening the <b>Run</b> settings of your project, expanding <b>Deploy Configurations</b> and removing the tick from the <b>Use local Qt libraries</b> check box. In this case, your application will have an external dependency called <b>Ministro</b>. If a user downloads your application, and it is the first application on their device to depend on Ministro, they will be asked to install it before they can run your application. Ministro downloads Qt libraries from a repository of your choice. The repository URL can be set by editing the file <i>android/res/values/libs.xml</i> which is created by Qt Creator when configuring your project. Ministro will then serve as a central repository for Qt libraries, and several apps can share the libraries to limit the amount of duplication. Note that using this deployment method requires a repository for the libraries you want to distribute.</p>
<a name="deployment-for-debugging"></a>
<h3 >Deployment for Debugging</h3>
<p>The third method is more convenient when you are simply testing your application on a device physically connected to your development machine (or an emulator). It will copy the Qt libraries into a temporary directory on your device and run the application against these instead. An APK built in this way is not distributable, since it relies on the device being prepared to contain the Qt libraries in the correct location. However, since the Qt libraries are only copied into the device once, it benefits from a faster turn-around time, so it's more suited for testing changes to your application during development. This deployment method can be selected by opening the <b>Run</b> settings of your project, expanding <b>Deploy Configurations</b> and choosing <b>Deploy local Qt libraries</b>. Make sure the <b>Use local Qt libraries</b> check box is also ticked.</p>
<a name="plugins-and-imports-special-considerations"></a>
<h2 id="plugins-and-imports-special-considerations">Plugins and Imports Special Considerations</h2>
<p>If an application uses plugins or imports that depend on other modules, these modules have to be listed in the application's dependencies. This is because Qt Creator does not know ahead of time which imports or plugins your application will end up loading.</p>
<p>For example, if your application's QML code imports Qt Multimedia, then the Qt Multimedia module must explicitly be made a dependency of the application. You can do this by adding it to the application .pro file:</p>
<pre class="cpp">

  QT <span class="operator">+</span><span class="operator">=</span> multimedia

</pre>
<p>It is also possible to manually enable dependencies on Qt libraries by opening the <b>Run</b> settings of your project, expanding <b>Package configurations</b> and selecting the <b>Libraries</b> tab. Manually check the libraries that are dependencies of your project.</p>
<a name="text-special-considerations"></a>
<h2 id="text-special-considerations">Text Special Considerations</h2>
<p>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, which increases memory consumption and can also affect text rendering performance. Before Qt 5.3&#x2e;2, the workaround was enabled only for a particular set of devices. It is now used by default on all devices.</p>
<p>You can disable the workaround by setting the <code>QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND</code> environment variable to <code>1</code>. You should do so only after verifying that text appears correctly on all targeted devices.</p>
<a name="opengl-special-considerations"></a>
<h2 id="opengl-special-considerations">OpenGL Special Considerations</h2>
<p>There are some special considerations to be made when OpenGL is used. The platform plugin only supports full screen top-level OpenGL windows. This means that even dialogs and popups will be shown as full screen. There may also be drawing errors if you try to stack windows that have animations or otherwise require updating their UI while they are obscured by another window.</p>
<p>It is recommended that you try to avoid multiple top-level windows in the case of Android apps, as there is no traditional window system on this platform.</p>
<p><b>Note: </b>Embedding a QGLWidget inside a widget hierarchy is not supported. When QGLWidget is in use, it must be the top-level widget.</p><p><b>Note: </b>Avoid using the legacy QGLWidget. For embedding OpenGL or Qt Quick content into a widget-based user interface, prefer using QOpenGLWidget and QQuickWidget.</p><p>Modern devices often support OpenGL ES 3.0 or 3.1 in addition to 2.0&#x2e; To get a suitable OpenGL context, set the requested version via QSurfaceFormat::setVersion(). Note however that the header files are only available in recent API levels, for example to include gl31.h, you need to target API level 21. Keep in mind also that using OpenGL ES 3.x features will result in the application breaking on older devices that only support 2.0&#x2e;</p>
<a name="multimedia-special-considerations"></a>
<h2 id="multimedia-special-considerations">Multimedia Special Considerations</h2>
<p>The Qt Multimedia Widgets module is not supported on Android, which means video display is only available using the VideoOutput and the Video QML Type.</p>
<a name="assets-file-system"></a>
<h2 id="assets-file-system">Assets File System</h2>
<p>Qt for Android provides a special, virtual file system which is based on the <i>assets</i> mechanism in Android. Files that are put under <i>assets</i> in the <i>android</i> folder created by Qt Creator, will be packaged as part of your application package. These can be accessed in Qt by prefixing the paths with <code>assets:/</code>. For instance, to access the image <i>logo.png</i> in the folder <i>assets/images</i>, you can use <code>QPixmap(&quot;assets:/images/logo.png&quot;)</code>.</p>
<p>If using the assets mechanism is not required for your app, the recommended way of distributing resources with your Qt app is to use The Qt Resource System, which is a cross-platform mechanism for distributing resources with your app.</p>
<a name="supported-architectures"></a>
<h2 id="supported-architectures">Supported Architectures</h2>
<p>Qt for Android currently has binaries for ARMv7 and x86. Make sure you select the correct architecture for the device or emulator you are targeting, otherwise your application will crash. The MIPS archictecture is currently not supported by Qt.</p>
<p>If you want to support several different architectures in your application, the recommendation is to build separate APKs for each architecture, so that each APK only contains the binaries required for the targeted architecture. For more information about this, see the Android documentation about <a href="http://developer.android.com/google/play/publishing/multiple-apks.html">Multiple APK Support</a>.</p>
</div>
<!-- @@@platform-notes-android.html -->
<p class="naviNextPrevious footerNavi">
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    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. </p>
</div>
</body>
</html>