Important: Please read the Qt Code of Conduct -

Can't get QT5 to build for Android on my Windows 7 machine

  • My computer is i5 64 bit processor, running a 32 bit Windows 7.
    I use cygwin as terminal, however I have also used windows terminal with same result. I use strawberry perl 5.8 as mentioned in the link i share.

    My android is latest, so android api is "android-23".

    I followed the instructions given in this page: , and the page linked from it. So I got the qt5 source by the following way:

    git clone git:// qt5
    cd qt5
    perl init-repository

    Then I run configure as mentioned there, by giving it the path to Android ndk etc.

    configure runs ok. It creates the makefile, which gives the first error as:

    Can't open perl script "'C:\android\cleanqt5\qtbase\bin\'": Invalid argument

    So apparently, some internal script was calling perl by surrounding the filename with quotes. I had to edit the file


    and replace ' with nothing in the path that is passed to the perl.

    After this change, it goes fine.

    After that, I get into a lot of errors of form where there are #include directives of the following form

    #include <QMutex>

    there is no .h mentioned there. So I now have to edit the source files, and add a .h to every file that is complaining about it. 42 files later, I got to build qtbase/src/corelib

    after that, I am now stuck in qtbase/src/network

    There are a log of files here which mention directories "private" and "QtNetwork", but these directories are not present in the source tree at all. For example, this file :

    #include "QtNetwork/qhostaddress.h"

    but I can't find QtNetwork folder anywhere. qhostaddress.h would be found somewhere else, so now I have to edit this file, and dozens others.

    What am I doing wrong, or is this the way to build QT5 so that I can make android apps on my win32 computer?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, you need perl 5.14 or newer to build Qt from sources and you installed 5.8. The rest of the problem is probably related to that since you are missing the auto-generated header which is a step that's done using perl.

  • Sorry, I just checked again, that my perl is 5.20. "This is perl 5, version 20, subversion 1 (v5.20.1) built for MSWin32-x86-multi-thread-64int"

    I actually didn't need to build the QT, I now found out, cause I just installed it from qt-project site. However, I still wonder what's wrong with this build procedure, because I did just what's written on that page afaik.

  • Lifetime Qt Champion

    I can't tell, except that there's something fishy going on with perl as it seems. Since version 16 is the minimal version, I'd first check with that one.

    On a side note, it's Qt. QT stands for Apple QuickTime that you might also use

  • Hi SGaist,

    Is there any other way rather than ( for developing Qt project on Android devices? I am new to Qt. I have finished a project using Qt 5.0.2 on my desktop computer and wanted to have an android app for my project. I have tried the above link but got all types of errors! I have also found that there is a tool called Neccessitas which is the android port of Qt4. Is there anything similar to Neccessitas for Qt 5 too? In another word, my question is that what is the simplest way of porting an existing Qt 5 project to Android?

    Thanks in advance

  • Lifetime Qt Champion


    No need for Necessitas with Qt 5 although the Ministro service can be used.

    The simplest way is to download the pre-built package for your OS. You should grab the latest (5.4 at this time)

Log in to reply