Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 383
X.Strange Avatar asked Nov 27 '22 04:11

X.Strange


1 Answers

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 (option 1 below) or via aqtinstall (option 2 below) are by far the simplest solutions and I'd recommend that. But anyway, here's the complete list of all the options you have in principle:

 

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
like image 66
tanius Avatar answered Nov 28 '22 19:11

tanius