Building Qt/Android on Windows
Tested last time on stable-a4d41f6 2013-06-19
Note, it is not currently possible to use Microsoft’s compilers to build the Windows host tools for Qt Android.
—————————— Configuration ——————————
- Install the latest Perl:
http://strawberryperl.com/
Select Destination folder (we’ll call this <PERL_ROOT>, and refer similarly to other install locations).
- Install the latest mingwbuilds MSYS and external binaries (for git):
http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/msys+7za+wget+svn+git+mercurial+cvs-rev13.7z/download
Extract this to <MINGW_BUILDS_ROOT> (I use C:\mingw-builds\ so I end up with C:\mingw-builds\msys\)
- Install the latest MinGW-w64 from mingwbuilds:
http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/32-bit/threads-win32/dwarf/x32-4.8.1-release-win32-dwarf-rev1.7z/download
extract to <MINGW_BUILDS_ROOT> and add <MINGW_BUILDS_ROOT>\mingw32\bin to the front of your PATH.
- Install the latest JDK 7:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Add <JDK_ROOT>\bin to PATH.
- Install the latest Necessitas Android NDK:
http://mingw-and-ndk.googlecode.com/files/android-ndk-r8e-ma-windows-x86.7z
Extract to <ANDROID_NDK_ROOT>
- Install the latest Android SDK (tools only):
http://developer.android.com/sdk/index.html
Run the SDK and install Platform 10 to <ANDROID_SDK>
For building QtMultimedia, also install Platform 11.
- Open cmd.exe window and perform some checks:
Ensure “where gcc.exe” lists <MINGW_ROOT>\bin\gcc.exe first (before <PERL_ROOT>\c\bin\gcc.exe)
Ensure “where mingw32-make.exe” lists <MINGW_ROOT>\bin\mingw32-make.exe first.
Ensure “where perl.exe” lists <PERL_ROOT>\perl\bin\perl.exe first.
Ensure “where javac.exe” lists <JDK_ROOT>\bin first.
- Add some environment variables:
set “ANDROID_NDK_PLATFORM=android-9”
set “ANDROID_TARGET_ARCH=armeabi-v7a”
set “ANDROID_BUILD_TOOLS_REVISION=17.0.0”
set “ANDROID_NDK_HOST=windows-x86_64”
or
set “ANDROID_NDK_HOST=windows”
.. depending on which NDK you downloaded.
—————————— Cloning ——————————
- Make the root folder for the Qt/Android build:
Make sure there are no spaces in this path and that it doesn’t contain too many characters.
I went for “C:\work\build”
-
mkdir C :\work\build
-
cd C :\work\build
-
- Follow step 4 at http://qt-project.org/wiki/Qt5ForAndroidBuilding
—————————— Build steps ——————————
-
configure. bat -developer -build -platform win32 -g ++ -opengl es2 -xplatform android -g ++ -android -ndk <ANDROID_NDK > -android -sdk <ANDROID_SDK > -android -toolchain -version 4.7 -opensource -confirm -license -nomake tests -nomake examples
-
mingw32 -make. exe -j <N >
..where <N> is the number of parallel jobs your system can optimally exploit.
- Follow steps 7..11 at http://qt-project.org/wiki/Qt5ForAndroidBuilding (replacing make with mingw32-make.exe)
—————————— Finally ——————————
You can also build Qt/Android from the MSYS shell – the one from mingw-builds that you already downloaded – following much the same procedure and using exactly the same software. This is currently left as an exercise for the reader.