IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Getting Started with Qt for Android

Provides instructions to install and configure your development environment.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Getting Started with Qt for Android

The video below is a beginner's guide to using the Qt for Android toolchain, including the Qt Creator IDE, to get you started developing Android apps.


Cliquez pour lire la vidéo


The rest of this page has more detailed getting started information.

To download and install Qt for Android, follow the instructions on the Getting Started with Qt page.

Android Development Prerequisites

In order to develop with Qt for Android, you will also need the following prerequisites:

The easiest way to manage these dependencies is by using Qt Creator's built in Android development setup. For more information, see Qt Creator: Specifying Android Device Settings.

Manually Installing the Prerequisites

If you prefer to manually install the prerequisites please follow these next steps.

Java Development Kit (JDK)

Qt for Android development requires JDK 11 or above, provided by any of the following supported distributions:

Please install your preferred JDK, and then make sure the JAVA_HOME environment variable is pointing to the location of the installed JDK.

For example for Linux:

 
Sélectionnez
sudo apt-get install openjdk-11-jdk
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

Or for macOS:

 
Sélectionnez
brew install openjdk@11
sudo ln -sfn "$(brew --prefix openjdk@11)/libexec/openjdk.jdk" "/Library/Java/JavaVirtualMachines/openjdk-11.jdk"
export JAVA_HOME="$(/usr/libexec/java_home -v 11)"
Android SDK Command Line Tools

Install the latest version of the Android SDK Command Line Tools for your operating system, and verify that the installation succeeded by running the sdkmanager binary:

 
Sélectionnez
sdkmanager --version

Then make sure the ANDROID_SDK_ROOT environment variable is pointing to the location of the installed command line tools.

For example for macOS:

 
Sélectionnez
brew install android-commandlinetool
export ANDROID_SDK_ROOT="$(brew --prefix)/share/android-commandlinetools"
Android SDK

The required version of the Platform, Platform Tools, and Build Tools for 6.4 is 31.

To install all of these run the following command:

 
Sélectionnez
sdkmanager "platforms;android-31" "platform-tools" "build-tools;31.0.0"
Android NDK

The required version of the Android NDK for 6.4 is 23.1.7779620.

To install the NDK run the following command:

 
Sélectionnez
sdkmanager "ndk;23.1.7779620"

Then make sure the ANDROID_NDK_ROOT environment variable is pointing to the location of the installed NDK.

For example for macOS:

 
Sélectionnez
export ANDROID_NDK_ROOT="$(brew --prefix)/share/android-commandlinetools/ndk/23.1.7779620/"
Emulator

If you wish to use the Android Emulator, you can install it by running:

 
Sélectionnez
sdkmanager "emulator" "patcher;v4"
Platform Specific Configurations
 
Windows

The default USB driver on Windows does not allow debugging using Android Debug Bridge (ADB) tool. You must install the additional USB driver provided by the extras Android SDK package. To install it, run the following:

 
Sélectionnez
sdkmanager.bat "extras;google;usb_driver"

After the package installation is complete, install the driver from <ANDROID_SDK_ROOT>/extras/google/usb_driver. Try running a few basic adb commands now and check whether your Android device responds to them.

Linux

The following dependencies are needed for using tools such as adb or gdb which can be used by Qt Creator:

 
Sélectionnez
sudo apt-get install libstdc++6 libncurses5

To run the Android emulator, the following dependencies are also necessary:

 
Sélectionnez
sudo apt-get install libsdl1.2debian
Testing Your Setup

Now you can test your development setup by running the examples shipped with the Qt installation. For more information, see Qt for Android Examples.

To develop a simple application from scratch, see Qt Creator: Creating a Mobile Application.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+