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:
=Building Qt/Android on Windows=
=Building Qt/Android on Windows=


Tested last time on stable-a4d41f6 2013-06-19
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.
Note, it is not currently possible to use Microsoft’s compilers to build the Windows host tools for Qt Android.
Line 15: Line 15:
* '''Install the latest <span class="caps">JDK</span> 7:'''<br />http://www.oracle.com/technetwork/java/javase/downloads/index.html<br /> Add &lt;<span class="caps">JDK</span>_ROOT&gt;\bin to <span class="caps">PATH</span>.
* '''Install the latest <span class="caps">JDK</span> 7:'''<br />http://www.oracle.com/technetwork/java/javase/downloads/index.html<br /> Add &lt;<span class="caps">JDK</span>_ROOT&gt;\bin to <span class="caps">PATH</span>.


* '''Install Android <span class="caps">NDK</span>:'''<br />https://developer.android.com/tools/sdk/ndk/index.html<br /> Extract to &lt;<span class="caps">ANDROID</span>_NDK_ROOT&gt;
* '''Install Android <span class="caps">NDK</span>:'''<br />https://developer.android.com/tools/sdk/ndk/index.html<br /> Extract to &lt;<span class="caps">ANDROID</span>_NDK_PATH&gt;<br /> If you have ndk9 installed update it to latest version cause it doesn’t work any more.


* '''Install the latest Android <span class="caps">SDK</span> (tools only):'''<br />http://developer.android.com/sdk/index.html<br /> Run the <span class="caps">SDK</span> and install Platform 10 to &lt;<span class="caps">ANDROID</span>_SDK&gt;<br /> For building QtMultimedia, also install Platform 11.
* '''Install the latest Android <span class="caps">SDK</span> (tools only):'''<br />http://developer.android.com/sdk/index.html<br /> Run the Android <span class="caps">SDK</span> Manager and install the latest version of “<span class="caps">SDK</span> Platform”, “Google <span class="caps">API</span>s” and “build-tools” in &lt;<span class="caps">ANDROID</span>_SDK_PATH&gt;


* '''Open cmd.exe window and perform some checks:'''<br /> Ensure “where gcc.exe” lists &lt;<span class="caps">MINGW</span>_ROOT&gt;\bin\gcc.exe first (before &lt;<span class="caps">PERL</span>_ROOT&gt;\c\bin\gcc.exe)<br /> Ensure “where mingw32-make.exe” lists &lt;<span class="caps">MINGW</span>_ROOT&gt;\bin\mingw32-make.exe first.<br /> Ensure “where perl.exe” lists &lt;<span class="caps">PERL</span>_ROOT&gt;\perl\bin\perl.exe first.<br /> Ensure “where javac.exe” lists &lt;<span class="caps">JDK</span>_ROOT&gt;\bin first.
* '''Open cmd.exe window and perform some checks:'''<br /> Ensure “where gcc.exe” lists &lt;<span class="caps">MINGW</span>_ROOT&gt;\bin\gcc.exe first (before &lt;<span class="caps">PERL</span>_ROOT&gt;\c\bin\gcc.exe)<br /> Ensure “where mingw32-make.exe” lists &lt;<span class="caps">MINGW</span>_ROOT&gt;\bin\mingw32-make.exe first.<br /> Ensure “where perl.exe” lists &lt;<span class="caps">PERL</span>_ROOT&gt;\perl\bin\perl.exe first.<br /> Ensure “where javac.exe” lists &lt;<span class="caps">JDK</span>_ROOT&gt;\bin first.


* '''Add some environment variables:'''<br /> set “<span class="caps">ANDROID</span>_NDK_PLATFORM=android-9”<br /> set “<span class="caps">ANDROID</span>_TARGET_ARCH=armeabi-v7a”<br /> set “<span class="caps">ANDROID</span>_BUILD_TOOLS_REVISION=17.0.0”<br /> set “<span class="caps">ANDROID</span>_NDK_HOST=windows-x86_64”<br /> or<br /> set “<span class="caps">ANDROID</span>_NDK_HOST=windows”<br /> .. depending on which <span class="caps">NDK</span> you downloaded.
* '''Add some environment variables:'''<br /> set “<span class="caps">ANDROID</span>_API_VERSION=android-21”<br /> set “<span class="caps">ANDROID</span>_SDK_ROOT=&lt;<span class="caps">ANDROID</span>_SDK_PATH&gt;”<br /> set “<span class="caps">ANDROID</span>_TARGET_ARCH=armeabi-v7a”<br /> set “<span class="caps">ANDROID</span>_BUILD_TOOLS_REVISION=21.1.2”<br /> set “<span class="caps">ANDROID</span>_NDK_PATH=&lt;<span class="caps">ANDROID</span>_NDK_PATH&gt;”<br /> set “<span class="caps">ANDROID</span>_TOOLCHAIN_VERSION=4.9”<br /> set “<span class="caps">ANDROID</span>_NDK_HOST=windows-x86_64”<br /> or<br /> set “<span class="caps">ANDROID</span>_NDK_HOST=windows”<br /> .. depending on which <span class="caps">NDK</span> you downloaded.


==—————————— Cloning ——————————==
==—————————— Cloning ——————————==

Revision as of 07:16, 10 February 2015

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>, 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”, “Google APIs” and “build-tools” in <ANDROID_SDK_PATH>
  • 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_API_VERSION=android-21”
    set “ANDROID_SDK_ROOT=<ANDROID_SDK_PATH>”
    set “ANDROID_TARGET_ARCH=armeabi-v7a”
    set “ANDROID_BUILD_TOOLS_REVISION=21.1.2”
    set “ANDROID_NDK_PATH=<ANDROID_NDK_PATH>”
    set “ANDROID_TOOLCHAIN_VERSION=4.9”
    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”

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

..where <N> is the number of parallel jobs your system can optimally exploit. If you have trouble, remove the -j<N>, and try again.

—————————— 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.