Deploy Qt apps to Android using Qt 5.1

UPDATE: This was initially made for Qt 5.1 RC1, but it also works for Qt 5.1 final.

UPDATE 2: Here is a video by Василий Колесников  that explains it all:

OK, so I was having some issues (probably most of them) when I decided to try to deploy a Qt application to my Android device. And as a reminder to myself, and probably as a help for others, I have decided to make a small guide for how to do this step by step.

0. Computer setup

I am using Windows 8 Pro 64-bit as my OS. But I guess most of the stuff will be the same regardless if using Mac or any Linux OS. Let me know of any major differences and I will write it down.

1. Download all the necessary files

Android SDK (64 bit):

Android NDK (64-bit):

JDK (64-bit):

I guess OpenJDK will work as well on Linux:

Ant:  (grab the zip archive)

Qt 5.1 RC1:

I got the qt-windows-opensource-5.1.0-rc1-android-x86-win32-offline.exe version.

Qt 5.1 Final:

I got the Qt 5.1.0 for Android (Windows 32-bit, 716 MB) version

2. Install software

Start with installing JDK. On my computer the default location is: C:\Program Files\Java\jdk1.7.0_21

Now you need to create a system environment variable for other programs to know about this location.

Get into System “Control Panel – > System and Security -> System”. On the top-left- side you will have several links, one is called Advanced System Settings.

Advanced System Settings
Advanced System Settings

Press the Environment Variables and there you should add a new System Variable:

Java Home
Java Home

The Variable value should be the folder where you have installed JDK.

IMPORTANT: Make sure you write this one correctly and make sure you have the “\” at the end. And do not add the \bin folder, that will result in in an error when running Ant later on.

I made a folder on my drive: D:\android where I place all the android related stuff.

Android folder
Android development folder.

That required some renaming of the  NDK folder and Ant folder, but that does not impact the development environment at all.

Now go back to the Environment Variables and locate the Path System Variable and add the following paths:

C:\Program Files\Java\jdk1.7.0_21\bin;D:\android\sdk\tools;D:\android\sdk\platform-tools

IMPORTANT: Make sure that these folders points to YOUR installation and folder setup. They will most likely differ from the above. The separator “;” between each path is very important.

For Qt I installed in the default folder: C:\Qt\Qt 5.1.0 and installed everything.

Qt Install
Qt Install

Next, Next next…

IMPORTANT: Restart your computer! This makes sure that System variables are saved and probably a hundred other things that are important.

3. Android SDK

Start Eclipse: Should be D:\android\eclipse\eclipse.exe or wherever you placed the Android SDK.

If you have any issues starting Eclipse it will most likely be that JDK is not installed or that you did not add JDK to your Path system variable.

Now press the Android SDK Manager button:

Android SDK Manager
Android SDK Manager

Qt for Android only support Android API 10 and above so make sure you have at least one of those installed. And make sure that your device support it as well, if you plan to deploy your app to the device. Also make sure you have the Google USB Driver installed.

Android SDK Installer
Android SDK Installer

Now start Qt Creator and do not create a new project. Navigate to Tools -> Options -> Android and fill in the correct values:

Qt Android Settings
Qt Android Settings

Now, Apply and quit Qt Creator and restart your computer! Just to be safe!

4. Create your Qt Android Project

First start up a shell (cmd.exe) and see if you have Android Debug Bridge working.

cd c:\


If you get a lot of output from the adb command then it is installed and adb is in your Path environment.

Now start Qt Creator and create a new Qt Quick 2 Application (Built-in Elements) project. Name it Test.

For target you should now have several Android targets as well. Check of Android for arm (GCC 4.7, Qt 5.1.0).

Android Targets
Android Targets

Now there seems to be a bug if you try to create a project on another drive than where Qt is installed. For me I have Qt on C:\ but I usually have my projects on D:\. That does not seem to work in my version of Qt 5.1.0 RC1 using Qt Creator 2.7.2 at least. It worked fine with Qt 5.0.2 and Qt Creator 2.7.0.


Navigate to Projects -> Android for arm kit -> Run Settings -> Package Configurations

Package Configurations
Package Configurations

Make sure that your settings are as the above image. If it is not, then you might need to restart your computer or click a blank Android target SDK drop-down and select which API to use. If your Package name is just “.Test” then you need to edit the AndroidManifest.xml file which is in your project folder and in the android folder.


Locate the manifest tag and the package value at the top and change it to something similar as “” and it should be fine.

5. Deploy to device

Connect your Android device to your computer using USB cable and make sure you have enabled it to debug:

To see if it working you could use the shell and adb:

adb devices

This will list all the devices connected to your computer.

Now the last step is just to press Play (and Pray)!

Are you lucky, then the app will be launching on your device in a few seconds.

And then we are done! I hope this little guide can help anyone, and that you enjoy your Qt for Android hacking!



17 thoughts on “Deploy Qt apps to Android using Qt 5.1

  1. I did exactly this when installing, but I have a strange error when trying to deploy to the device:

    [install_itemfolder_01] Error 1

    Any ideas why it would do that? I triple-checked that my device was connected via ADB, and the Necessitas SDK has worked in the past.

      1. That’s the only part of the error message, besides the “make error”, unfortunately. I was using MinGW_32, but that’s about it. The only thing I can figure out is the .pro file seems to have some sort of target related.

      2. If you post the compile output then I can see what other things is happening. I’m not just interested in the error message. Are you using Android for x86 or Android for ARM?

      3. Android x86 I believe. I’ll get a full output log soon, but for now I’m away from the machine with everything setup for the development (JDK, etc.).

  2. Hi, good sharing, but when i execute i found one problem, the emulator is start, but no app is running, after close the emulator. It show message as below:

    16:47:31: The process “C:\Qt\Qt5.1.0\Tools\mingw48_32\bin\mingw32-make.exe” exited normally.
    16:47:31: Elapsed time: 00:08.
    16:48:46: Please wait, searching for a suitable device for target:android-18.
    Error while building/deploying project q (kit: Android for arm (GCC 4.6, Qt 5.1.0))
    When executing step ‘Deploy to Android device’

    can please help on this, and thank in advance

      1. First you should start your emulater, and make sure it works. It takes a few minutes. Then when it is up and running you should try to deply. Do not close it after one deply, it can be running while you fix your code.

        Anyway, try to use a device if you have, the emulator is really slow. If you need to use an emulator then try out:

  3. Thank you for your reply, the emulator can work, but no app is running after the emulator open. But when I run ant.bat, it show up a error: Buildfile:build.xml does not exist. I don’t know is it this is the root cause.

  4. thanks dude,

    I dont think the path variable are really neccessary but my fault was the wrong Java SDK.

    I thought it was inside the Android SDK in the folder Eclipse. But when you try it for hours your dont see the obvious things.

    by the way you DO NEED Android SDK, Android NDK, Java SDK, Appache Ant.

    But come on Qt Developers, why you not simply include them in your installation.
    I feel kinda stupid downloading everything separately and hopeing it will work lol

  5. So it’s me again. After trying to develop some Android Apps using Qt I can surely say, it’s not worth doing it.

    Sofar v.5.10 but also 5.20 alpha is so immensely buggie, I wonder if someone ever wrote anything useful with that Framework.

    The Qt Creator takes like forever to compile simple Apps and often crashes or just freeze without any reasons.

    Plus the finished .apk files are giantly big. my HelloWorld.apk took 6mb,
    comparing to native Eclipse C# was only 60kb.

    Moreover I wasnt able to load my .apk on BlueStack but also not able to load it on my Android Phone. It crashes without any reason.
    Which API version I should or I can use it not clearly noticed either.

    So all in all the Qt Developers may need more than 2years to release a functioning version. But sofar it’s just a gimmick.

  6. I am new to QT Android. I am trying to establish a connection between google api client from my android source. I have followed all the necessary procedures like getting google play services library , mentioning it in application tag (manifest file), created a keystore using QT and generated SHA1 using keytool . Created a Project in Google console, enabled Fitness APi and mentioned SHA1 and package name, Client OAUTH 2 id. Still I am getting status error code 4 and running in QT 5.6 (QT Creator 3.6.1). Kindly help me. I am able to get Fitness API values through Android Studio.

    Please have a look at the details I posted in stackoverflow.

    1. Hi Raj, I will take a look when I have the time. Been a while since I tried did some Android + Qt development, but I will see what I find out.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s