Congratulations to our 2022 Qt Champions!

Incorrect __ANDROID_API value when building QT from sources.

  • I am building QT for Android on Windows with the following command file:

    set PATH=C:\PFiles\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin;%PATH%
    set PATH=%PATH%;C:\Program Files\Android\Android Studio\jre\bin
    set PATH=%PATH%;C:\PFiles\Python35 
    rem Check if the tools are in PATH
    where gcc
    where mingw32-make.exe
    where perl.exe
    where javac.exe
    set "ANDROID_TARGET_ARCH=armeabi-v7a"
    rem see ANDROID_SDK_ROOT\build-tools\ folder
    rem The same values as in QT Creator:
    set "ANDROID_API_VERSION=android-19"
    set "ANDROID_SDK_ROOT=C:\Users\D-Ef\AppData\Local\Android\Sdk"
    set "ANDROID_NDK_PATH=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle"
    set "ANDROID_NDK_HOST=windows-x86_64"
    configure.bat -prefix C:\Qt\Qt5.11-Android -release -force-debug-info -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 -skip qtserialport -skip qtquick1 -skip webengine -skip websockets -skip webchannel -skip qt3d -skip charts -skip connectivity -skip datavis3d -skip doc -skip gamepad -skip location -skip sensors -skip serialbus -skip purchasing -skip wayland
    rem mingw32-make.exe -j2

    where I set Android API level to 19, but there is -D__ANDROID_API__=16 in the compiler command line

    Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 ...

  • Moderators

    You need to set ANDROID_NDK_PLATFORM=android-19 to set the NDK definition correctly. The ANDROID_API_VERSION is for the SDK.

Log in to reply