Difference between revisions of "Using Qt for Android (July 2017)"
(Created page with " = Installation = == Qt libraries and QtCreator == https://info.qt.io/download-qt-for-application-development In the website of Qt, [https://info.qt.io/download-qt-for-ap...") |
m (Daniel moved page Using Qt for Android to Using Qt for Android (July 2017)) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Qt libraries and QtCreator == | == Qt libraries and QtCreator == | ||
− | |||
− | |||
− | |||
− | |||
In the website of Qt, [https://info.qt.io/download-qt-for-application-development download the Qt installer open-source application development]. Then go to the directory where it is downloaded, make it executable and run it as root: | In the website of Qt, [https://info.qt.io/download-qt-for-application-development download the Qt installer open-source application development]. Then go to the directory where it is downloaded, make it executable and run it as root: | ||
Line 15: | Line 11: | ||
</pre> | </pre> | ||
− | When the next window appears then click on ''skip'' to continue without registering | + | When the next window appears then click on ''skip'' to continue without registering: |
+ | |||
[[File:qtinst1.png]] | [[File:qtinst1.png]] | ||
− | Then choose the installation path, the default one is usually a good choice | + | Then choose the installation path, the default one is usually a good choice: |
+ | |||
[[File:qtinst2.png]] | [[File:qtinst2.png]] | ||
+ | Make sure that the Tools and a version of the Qt libraries are selected, inside it also select the android packages: | ||
+ | |||
+ | [[File:qtinst3.png]] | ||
+ | |||
+ | Once the installation is finished you can add the ''qtcreator'' executable to the system PATH or link into a directory that is already in it: | ||
<pre> | <pre> | ||
sudo ln -sf /opt/Qt/Tools/QtCreator/bin/qtcreator.sh /usr/local/bin/qtcreator | sudo ln -sf /opt/Qt/Tools/QtCreator/bin/qtcreator.sh /usr/local/bin/qtcreator | ||
Line 26: | Line 29: | ||
− | == Android Tools == | + | == Android Tools & SDK == |
+ | |||
+ | To install the android tools follow the next instructions (the recommended version for now is r25.2.5). The first step is to download it and decompress it: | ||
+ | <pre> | ||
+ | sudo mkdir -p /opt/android | ||
+ | wget https://dl.google.com/android/repository/tools_r25.2.5-linux.zip | ||
+ | mkdir android-sdk | ||
+ | cd android-sdk | ||
+ | unzip ../tools_r25.2.5-linux.zip | ||
+ | </pre> | ||
+ | |||
+ | Then execute it to download the rest of the components: | ||
+ | <pre> | ||
+ | cd tools | ||
+ | ./android | ||
+ | </pre> | ||
+ | |||
+ | Make sure that ''Android SDK Platform-tools'', ''Android SDK Build-tools'' and at least one of the ''Android API'' are selected: | ||
+ | |||
+ | [[File:Androidtools1.png]] | ||
+ | |||
+ | [[File:Androidtools2.png]] | ||
+ | |||
+ | Then accept the license and after the installation is finish move the Android SDK to an accessible directory. | ||
+ | <pre> | ||
+ | cd ../.. | ||
+ | sudo mv android-sdk/ /opt/android/ | ||
+ | </pre> | ||
+ | |||
+ | The next step is to install the Android NDK (version r10e is recommended by Qt). Download it, uncompress it and copy it to the same directory as the SDK with the following commands: | ||
+ | |||
+ | <pre> | ||
+ | wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip | ||
+ | unzip android-ndk-r10e-linux-x86_64.zip | ||
+ | sudo mv android-ndk-r10e /opt/android/android-ndk | ||
+ | </pre> | ||
+ | |||
+ | == Integrate Android Tools in QtCreator == | ||
+ | |||
+ | First install the necessary dependencies: | ||
+ | <pre> | ||
+ | sudo apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 libsdl1.2debian:i386 libgl1-mesa-dev openjdk-8-jdk ant | ||
+ | </pre> | ||
+ | |||
+ | Then open QtCreator and go to the menu ''Tools -> Options -> Devices -> Android''. There set the paths to the different components as shown in the next image: | ||
+ | |||
+ | [[File:Qtcreatorandroid.png]] | ||
+ | |||
+ | Then check in the menu ''Tools -> Options -> Build & Run -> Kits'' that the Android Kits appear: | ||
+ | |||
+ | [[File:Qtcreatorandroid2.png]] | ||
+ | |||
+ | From that moment QtCreator will be able to compile and generate apk files from your Qt applications so that they can be executed in Android. |
Latest revision as of 16:01, 13 January 2019
Contents
Installation
Qt libraries and QtCreator
In the website of Qt, download the Qt installer open-source application development. Then go to the directory where it is downloaded, make it executable and run it as root:
chmod 777 qt-unified-linux-x64-3.0.0-online.run sudo ./qt-unified-linux-x64-3.0.0-online.run
When the next window appears then click on skip to continue without registering:
Then choose the installation path, the default one is usually a good choice:
Make sure that the Tools and a version of the Qt libraries are selected, inside it also select the android packages:
Once the installation is finished you can add the qtcreator executable to the system PATH or link into a directory that is already in it:
sudo ln -sf /opt/Qt/Tools/QtCreator/bin/qtcreator.sh /usr/local/bin/qtcreator
Android Tools & SDK
To install the android tools follow the next instructions (the recommended version for now is r25.2.5). The first step is to download it and decompress it:
sudo mkdir -p /opt/android wget https://dl.google.com/android/repository/tools_r25.2.5-linux.zip mkdir android-sdk cd android-sdk unzip ../tools_r25.2.5-linux.zip
Then execute it to download the rest of the components:
cd tools ./android
Make sure that Android SDK Platform-tools, Android SDK Build-tools and at least one of the Android API are selected:
Then accept the license and after the installation is finish move the Android SDK to an accessible directory.
cd ../.. sudo mv android-sdk/ /opt/android/
The next step is to install the Android NDK (version r10e is recommended by Qt). Download it, uncompress it and copy it to the same directory as the SDK with the following commands:
wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip unzip android-ndk-r10e-linux-x86_64.zip sudo mv android-ndk-r10e /opt/android/android-ndk
Integrate Android Tools in QtCreator
First install the necessary dependencies:
sudo apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 libsdl1.2debian:i386 libgl1-mesa-dev openjdk-8-jdk ant
Then open QtCreator and go to the menu Tools -> Options -> Devices -> Android. There set the paths to the different components as shown in the next image:
Then check in the menu Tools -> Options -> Build & Run -> Kits that the Android Kits appear:
From that moment QtCreator will be able to compile and generate apk files from your Qt applications so that they can be executed in Android.