Commit 22404e8b authored by Venu's avatar Venu Committed by The Qt Project
Browse files

Doc: Added getting started information for Android port


The new section provides guidance to:
- set up the environment and develop a simple app
- and port existing Qt apps.

Change-Id: Ib398285dce473d916426f88344518e0ed881e834
Reviewed-by: default avatarJerome Pasion <jerome.pasion@digia.com>
Reviewed-by: default avatarTopi Reiniö <topi.reinio@digia.com>
parent d8d5df7c
dev 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.9.8 6.0 6.0.0 6.1 6.1.0 6.1.1 6.1.2 6.1.3 6.2 6.2.0 6.2.1 6.2.2 old/5.1 old/5.2 tqtc/vxworks-5.5 v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.8.0-beta1 v5.8.0-alpha1 v5.7.1 v5.7.0 v5.7.0-rc1 v5.7.0-beta1 v5.7.0-alpha1 v5.6.3 v5.6.2 v5.6.1 v5.6.1-1 v5.6.0 v5.6.0-rc1 v5.6.0-beta1 v5.6.0-alpha1 v5.5.1 v5.5.0 v5.5.0-rc1 v5.5.0-beta1 v5.5.0-alpha1 v5.4.2 v5.4.1 v5.4.0 v5.4.0-rc1 v5.4.0-beta1 v5.4.0-alpha1 v5.3.2 v5.3.1 v5.3.0 v5.3.0-rc1 v5.3.0-beta1 v5.3.0-alpha1 v5.2.1 v5.2.0 v5.2.0-rc1 v5.2.0-beta1 v5.2.0-alpha1 v5.1.1 v5.1.0 v5.1.0-rc2 v5.1.0-rc1 v5.1.0-beta1
No related merge requests found
Showing with 129 additions and 7 deletions
...@@ -26,18 +26,140 @@ ...@@ -26,18 +26,140 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\page andriod_support.html \page android_support.html
\title Android \title Android
\brief Provides insight into Android support in Qt 5. \brief Provides information about Android support in Qt 5.
The Qt 5 port for Android should enable you to run Qt 5 applications on The Qt 5 port for Android enables you to run Qt 5 applications on
devices running Android v2.3.3 (API level 10) or later. Here is a list of devices running Android v2.3.3 (API level 10) or later. Here is a list of
supported items: supported items:
\list \list
\li Qt Widgets and Qt Quick applications \li \l{Qt Widgets} and \l{QML Application Developer Resources}{QML}
\li QML media player functionality in Qt Multimedia applications
\li A set of commonly used sensors with Qt Sensors \li QML media player functionality in \l{Qt Multimedia}
\li Deploying your application to a device from Qt Creator \li A set of commonly used sensors with \l{Qt Sensors}
\li Deploying your application to a device from
\l{Qt Creator Manual}{Qt Creator}
\endlist \endlist
\section1 Getting Started
The following step-by-step instructions guide you to set up the environment
on Ubuntu v12.04 and develop a simple helloworld Qt Quick 2 application:
\list 1
\li Download and install the latest Android NDK and SDK, and update the SDK to
get the API and tools packages needed for development. You can update the
SDK using the \l{http://developer.android.com/tools/help/android.html}
{android} tool that comes with the SDK package. For example, the following
command starts the \l{http://developer.android.com/sdk/installing/adding-packages.html}
{Android SDK Manager}, which enables you to select the packages you want
to install:
\code
./android update sdk
\endcode
\li Install the Qt 5.1 binaries and related tools using the Qt binary
installer. For more details, refer to \l{Qt Installation Program}.
\li Launch Qt Creator (v2.7.1) and configure it for Android development. For
more details, refer to \l{Qt Creator: Connecting Android Devices}.
\li Create a new project using the "Qt Quick 2 Application (Built-in Types)"
project template.
\li Configure the project to deploy the application to an Android device. For
more details, refer to
\l{Qt Creator: Deploying Applications to Android Devices}.
\note You can change the default settings for application icons and
identifier as described in \l{Qt Creator: Specifying Run Settings}.
\li Enable \e{USB Debugging} under \c{Developer Options} on your Android
device and connect it to the PC.
\note On Android v4.2.2, the "Developer Options" is hidden. You will see
it after tapping the "Build number" field in "Settings->About" seven
times.
\endlist
When your device is detected by the PC, run the application from
Qt Creator. Once the application is deployed on the targeted device,
you should see the application running.
\note The deployment process will take a while if the Qt libraries
were not installed on the Android device earlier.
\section1 Porting an Existing Qt Application
Most Qt applications should be portable to Android with ease, unless they
depend on a specific hardware or software feature not supported by Android.
If your application is not using any such feature, deployment is probably the
only step that demands some changes to your application.
Like most UI applications, Qt applications also depend on resources such as
images, icons, translation files, and so on. These resources must be made
available on the device as they are required for the application to function
effectively.
The most convenient option is to bundle the resources into a qrc file,
which gets built into the application binary. This approach reduces the porting
effort considerably and provides faster access to the resources. It is
also a cross-platform approach, which makes porting to other platforms easier.
By default, all Qt applications can access the contents of a qrc file using
the ":/" prefix or the URL scheme prefix, "qrc:". To know more about qrc files
and how they are handled, refer to
\l{The Qt Resource System}{the Qt Resource System}.
The other approach is to deploy the resources into the package's \c{assets}
directory. It is the best option if you want to achieve better
interoperability with the Android APIs. You can access all resources in the
directory using the "assets:" prefix. Unlike qrc, this approach is not a
cross-platform solution.
The following step-by-step instructions guide you to port an existing Qt Quick
application to Android using the qrc approach:
\list 1
\li Open the existing project in Qt Creator v2.7.1 or later, and configure it
with "Android for ARM" kit. For more details, refer to
\l{Qt Creator: Configuring Projects}
\li Update all local directory imports in the \c{qml} files to use a local
namespace. For example, to import the QML documents in the "contents"
directory relative to \c{main.qml}, use the following import statement:
\code
import "contents" as Contents
\endcode
\li Identify all the resources used by your application and add them to one
or more qrc files.
Qt Creator updates your qmake project file with the "RESOURCES"
variable listing the qrc files you added.
\li To load or refer to the resources in the qrc file from a C++ file,
use the "qrc:" prefix with the URL. For example, to load
the \c{main.qml} file from \c{resources.qrc}, you can use the following
code in your \c{main} function:
\code
QQuickView viewer;
viewer.setSource(QUrl("qrc:qml/main.qml"));
viewer.show();
\endcode
\note QML documents can refer to the contents in qrc files using the
relative path to the document. Such references do not require the
"\c{qrc:}" or "\c{:/}" prefix.
\li Update the "Run" settings for your project as described in the
\l{Qt Creator: Specifying Run Settings}
\note You can change the default settings for application icons and
identifier.
\li Save the changes to your project and run the application.
\endlist
Qt Creator deploys your application on the Android device, if the
device is detected by the PC. Otherwise, it tries to run the application on an
AVD (Android Virtual Device). You will be prompted to create one if there are no
AVDs found.
\section1 Related Information
\list
\li Platform Notes
\li \l{Qt Creator: Deploying Applications to Android Devices}
\endlist
*/ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment