Download the Qt Framework for Android (on Mac) from The Qt Company. Run the Qt Framework for Android installer, accepting all the defaults. Set up your environment to use OpenSSL. For more information, see the OpenSSL section of system requirements. In Qt Creator, click Qt Creator Preferences Devices Android, and fill in the paths. 1 day ago QT is also 1995 (I remember needing it to build KDE at the time). What all these fail with is when it comes to abstraction. Running a GTK app inside a QT.
Mac OS X; Android; iOS; Click here to see pyqtdeploy's documentation. It is a GUI tool that will package your PyQt5 application and compile it for the target platform. It lets you select various Qt modules to include in the compilation: On the command-line you would use the pyqtdeploy-build command like this: pyqtdeploy-build pyqt-demo.pdy.
Android is one of the Qt’s supported target platforms, so you can create applications for Android using Qt.
Here I’ll show you how to set-up Qt development environment for Android.
Actually, the process is already described in the Qt documentation: setting up both the environment and Qt Creator. However (as usual), there are some surprises that are waiting for you down the road, so I decided to complement the official guide with my comments and screenshots.
![Android Android](/uploads/1/2/7/7/127782192/624372011.jpg)
I recommend you to use the latest version of Qt (5.10 at the moment) and Qt Creator (4.5.0 at the moment), because some annoying Android-related issues were fixed there, and thus everything is easier now.
The process is more or less the same across all the major development hosts (Linux, Mac OS, Windows). I’ll do it for Linux (running inside a virtual machine on my Mac).
First, install Android component from the Qt installer:
I have here HTC Evo 3D (Android 4.0.3), Google Nexus 7 (Android 6.0.1), and Google Pixel C (Android 8.1.0):
…so I chose Android ARMv7.
Download and install Android Studio. I unpacked it to
~/programs/android-studio/
. Now run ~/programs/android-studio/bin/studio.sh
. It will ask you for an installation path (I chose ~/programs/android/
) and then install Android SDK and Android SDK Platform (latest version by default).If you want to check what’s installed, launch Android Studio again and go to settings:
Here’s what I have:
On Windows you will also need to install Google USB driver:
Now download and unpack Android NDK. I put mine to
~/programs/android-ndk/
. Note that at the moment (Qt Creator 4.7.1 and Qt 5.11.1) NDK version r18 won’t work, you should take 17c.Download and unpack JDK. At the moment there are some problems with JDK 9, so it is recommended to go with JDK 8. I put mine to
~/programs/jdk/
.Check if you have some not accepted licenses:
You might get this error:
I tried adding
JAVA_HOME
to environment variables, but it didn’t make any difference, so I simply added path to JRE (~/programs/jdk/jre/bin
) to the PATH
variable.Run it again:
and accept the licenses:
If you won’t accept all the licenses, something simply might not work.
So, here are all my paths:
- Android Studio:
~/programs/android-studio/
(although, this path is not needed); - Android SDK:
~/programs/android/
; - Android NDK:
~/programs/android-ndk/
; - JDK:
~/programs/jdk/
.
And now you can launch Qt Creator and set them all at the Android tab:
If something is wrong, it will offer you to download missing components:
Qt For Android Mac Download
And if you installed JDK 9, it will fail. I warned you.
If you don’t have Android tab in the Qt Creator settings, check if you have Android plugin enabled:
This part is done.
Now enable Developer mode (and USB debugging) on your Android device and connect it to your PC. You can check the connection by running:
I connected all 3 devices, so here’s my output:
On Linux you might see something like this, though:
Qt For Android Camera
On Windows it will be just:
Or, which is more confusing, you might get
ABI is incompatible
error while trying to deploy your application:Both issues (no permissions/unauthorized and incompatible ABI) most probably indicate that you didn’t allow your PC to debug your Android device via USB. It’s not necessarily your fault, especially if you (like me) never got this request in the first place. In order for your Android device to show you debugging request, you need to restart ADB daemon (while your device is connected to the PC):
Now you should get a dialog like this on your device:
Information from this page also tells to install Android adb tools package. I’m not sure how much use does it bring since we already have it from Android Studio, but okay:
Anyway, once you allow the debugging request, your device will be recognized by ADB (and Qt Creator deployment dialog).
Time to build and run some application on your Android device. I will use the Color Corners example again, which is not an Android application by design, but it’s a cross-platform framework we are dealing here with, so why the hell not.
If everything was set-up correctly, you should be able to see the Android build SDK version in your project build settings:
You can also add Android manifest and other templates:
Qt For Android Tutorial
That will allow you to specify the application name, icon, permissions and other stuff (but don’t use spaces, otherwise your application will fail to launch saying that it couldn’t find a library):
Now you can just run your application from Qt Creator:
And here we say “sorry” to HTC Evo 3D, because it has a really old Android API (15):
So we’ll launch our application only on Nexus 7 and Pixel C targets:
Qt For Android C11
As you can see, our application was successfully built for Android platform, so it is an
.apk
file, which can be either run on the connected device from Qt Creator, or you can copy it to the device manually and install it there.