简体   繁体   中英

Install Qt for android development on Ubuntu

I want to develop android application with Qt on Ubuntu now I want to know should I download Android version Qt for Linux from the qt.io site or I can install Qt development package from the Ubuntu repository and use it for develop android app too ?

I know I need some dependencies for develop for android and I have to download them (android sdk, ndk...) The question is how to install the Qt Android kit on Ubuntu from the Ubuntu repository not to download the binary version from the Qt website?

The question is how to install the Qt Android kit on Ubuntu from the Ubuntu repository [and] not to download the binary version from the Qt website?

The normal Ubuntu repositories provide only the "GCC 64 bit" version of Qt, which is not the one you need for developing for Android. To get the Android version, downloading from the Qt website (by using their installer) or via aqtinstall are by far the simplest solutions and I'd recommend that. But let's see all the alternatives as well:

Option 1: Install Qt for Android from the Qt website

  1. Download the Qt Online Installer from the Qt website and use that to install a version of Qt for Android.

  2. This necessarily also installs Qt Creator. If you want to stick with the Qt Creator from the Ubuntu repositories, you can delete this one easily again: sudo rm -R /opt/Qt/Tools/QtCreator/ .

  3. The Qt Online Installer is basically the same as the Qt Maintenance Tool that you'll have now in /opt/Qt/MaintenanceTool . Use that Qt Maintenance Tool from now on to modify and extend your Qt installations. (It's not contained in the Ubuntu repository, otherwise we'd not need this whole process.)

Option 2: Install Qt for Android with aqtinstall

The tool aqtinstall ("Another Qt Installer") is an unofficial Qt installer that can be used to install any Qt version on any target platform, such as Qt for Android on a x86_64 desktop PC running Ubuntu Linux.

This option is probably my favourite. While it does not install from the Ubuntu repositories, it is a command line tool like apt , avoiding the use of the GUI-only "Qt Maintenance Tool".

Option 3: Compile Qt for Android from source

(I did not try this yet, but it's a possibility.) Qt for Android is basically just the normal Qt libraries compiled for the ARMv7 or ARMv8 processor architecture. You can cross-compile that from the Qt sources on a desktop computer following these instructions .

Option 4: Install Qt for Android from the armhf / arm64 packages

(I did not try this, so it's totally experimental and probably won't work.) All Ubuntu packages incl. Qt packages come in versions for different processor architectures ( example ). This includes the armhf (= ARMv7+) and arm64 (= ARMv8) processor architectures found in smartphones . So by installing from these, you might be able to install "Qt for Android" from the Ubuntu repositories:

sudo apt install qt5-default:armhf

You may want to have a look at qt-android . There you can find sources & binary packages (deb) for debian. It may work on ubuntu too.

You need to follow the instruction as described here .

In order to use Qt for Android, you need the following:

  • The Android SDK Tools

  • The Android NDK

  • Java SE Development Kit (JDK) v6 or later. You can also use OpenJDK on Linux.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM