Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Building qt-android on windows: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
h1. Building Qt/Android on Windows
Tested last time on branch 5.4 2015-01-22
Tested last time on branch 5.4 2015-01-22



Revision as of 13:12, 23 February 2015

h1. Building Qt/Android on Windows

Tested last time on branch 5.4 2015-01-22

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&gt;, and refer similarly to other install locations).
  • Install the latest Android SDK (tools only):
    http://developer.android.com/sdk/index.html
    Run the Android SDK Manager and install the latest version of "SDK Platform&quot;, "Google APIs&quot; and "build-tools&quot; in <ANDROID_SDK_PATH&gt;
  • Open cmd.exe window and perform some checks:
    Ensure "where gcc.exe&quot; lists <MINGW_ROOT&gt;.exe first (before <PERL_ROOT&gt;.exe)
    Ensure "where mingw32-make.exe&quot; lists <MINGW_ROOT&gt;32-make.exe first.
    Ensure "where perl.exe&quot; lists <PERL_ROOT&gt;.exe first.
    Ensure "where javac.exe&quot; lists <JDK_ROOT&gt;first.
  • Add some environment variables:
    set "ANDROID_API_VERSION=android-21&quot;
    set "ANDROID_SDK_ROOT=<ANDROID_SDK_PATH&gt;"
    set "ANDROID_TARGET_ARCH=armeabi-v7a&quot;
    set "ANDROID_BUILD_TOOLS_REVISION=21.1.2&quot;
    set "ANDROID_NDK_PATH=<ANDROID_NDK_PATH&gt;"
    set "ANDROID_TOOLCHAIN_VERSION=4.9&quot;
    set "ANDROID_NDK_HOST=windows-x86_64&quot;
    or
    set "ANDROID_NDK_HOST=windows&quot;
    .. 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:"
    mkdir C:cd C:
    

——————— Build steps ———————

configure.bat -developer-build -platform win32-g++ -opengl es2 -xplatform android-g++ -android-ndk ANDROID_NDK_PATH -android-sdk ANDROID_SDK_ROOT -opensource -confirm-license -nomake tests -nomake examples<br />mingw32-make.exe -j&amp;lt;N&amp;gt;

..where <N&gt; is the number of parallel jobs your system can optimally exploit. If you have trouble, remove the j&lt;N&gt;, and try again.
* Follow steps 8..11 at http://wiki.qt.io/Qt5ForAndroidBuilding (replacing make with mingw32-make.exe)
h2. ——————— 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.