Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QMake uses android-16 API level instead of android-21
Forum Update on Monday, May 27th 2025

QMake uses android-16 API level instead of android-21

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David Demelier
    wrote on 6 Jun 2018, 11:43 last edited by
    #1

    Hi,

    I have built Qt 5.11 for android using the following command:

    ./configure                                                                 \
        -opensource                                                             \
        -confirm-license                                                        \
        -xplatform android-g++ --disable-rpath                                  \
        -nomake tests                                                           \
        -nomake examples                                                        \
        -no-sql-db2                                                             \
        -no-sql-ibase                                                           \
        -no-sql-mysql                                                           \
        -no-sql-oci                                                             \
        -no-sql-odbc                                                            \
        -no-sql-psql                                                            \
        -no-sql-sqlite2                                                         \
        -no-sql-tds                                                             \
        -android-arch x86_64                                                    \
        -android-ndk-platform android-21                                        \
        -android-ndk /home/markand/android/ndk                                  \
        -android-sdk /home/markand/android                                      \
        -android-ndk-host linux-x86_64                                          \
        -android-toolchain-version 4.9                                          \
        -skip qtcharts                                                          \
        -skip qtdatavis3d                                                       \
        -skip qtserialbus                                                       \
        -skip qtserialport                                                      \
        -skip qtspeech                                                          \
        -skip qttranslations                                                    \
        -skip qtvirtualkeyboard                                                 \
        -skip qtwayland                                                         \
        -skip qtwebchannel                                                      \
        -skip qtwebengine                                                       \
        -skip qtwebglplugin                                                     \
        -skip qtwebsockets                                                      \
        -skip qtwebview                                                         \
        -skip qtx11extras                                                       \
        -no-warnings-are-errors                                                 \
        -prefix ~/android/env/x86_64/21
    

    I have added ~/android/env/x86_64/21/bin/qmake to the Qt Creator kit, but when I try to create any project in QMake, it uses android-16 API level instead of 21, resulting in an error:

    /home/markand/android/ndk/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-g++ -c -D__ANDROID_API__=16 --sysroot=/home/markand/android/ndk/platforms/android-16/arch-x86_64/ -isystem /home/markand/android/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/markand/android/ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include -fstack-protector-strong -DANDROID -O2 -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../save-the-ball -I. -I../../android/env/x86_64/21/include -I../../android/env/x86_64/21/include/QtWidgets -I../../android/env/x86_64/21/include/QtGui -I../../android/env/x86_64/21/include/QtCore -I. -I../../android/env/x86_64/21/mkspecs/android-g++ -o main.o ../save-the-ball/main.cpp
    

    If I specify qmake ANDROID_PLATFORM=android-21 on command line the Makefile gets fixed. But I have no ideas why Qt Creator still uses 16 by default.

    R 1 Reply Last reply 6 Jun 2018, 11:48
    0
    • M Offline
      M Offline
      Mitmischer
      wrote on 6 Jun 2018, 11:48 last edited by
      #2

      @David-Demelier said in QMake uses android-16 API level instead of android-21:

      -android-ndk-platform android-21

      I'm not sure if that's the problem, but that looks like a typo to me (You should use Android NDK 10e). Maybe -android-platform or -android-sdk-platform are the right parameters (I don't know, you might have to check it)..

      1 Reply Last reply
      0
      • D David Demelier
        6 Jun 2018, 11:43

        Hi,

        I have built Qt 5.11 for android using the following command:

        ./configure                                                                 \
            -opensource                                                             \
            -confirm-license                                                        \
            -xplatform android-g++ --disable-rpath                                  \
            -nomake tests                                                           \
            -nomake examples                                                        \
            -no-sql-db2                                                             \
            -no-sql-ibase                                                           \
            -no-sql-mysql                                                           \
            -no-sql-oci                                                             \
            -no-sql-odbc                                                            \
            -no-sql-psql                                                            \
            -no-sql-sqlite2                                                         \
            -no-sql-tds                                                             \
            -android-arch x86_64                                                    \
            -android-ndk-platform android-21                                        \
            -android-ndk /home/markand/android/ndk                                  \
            -android-sdk /home/markand/android                                      \
            -android-ndk-host linux-x86_64                                          \
            -android-toolchain-version 4.9                                          \
            -skip qtcharts                                                          \
            -skip qtdatavis3d                                                       \
            -skip qtserialbus                                                       \
            -skip qtserialport                                                      \
            -skip qtspeech                                                          \
            -skip qttranslations                                                    \
            -skip qtvirtualkeyboard                                                 \
            -skip qtwayland                                                         \
            -skip qtwebchannel                                                      \
            -skip qtwebengine                                                       \
            -skip qtwebglplugin                                                     \
            -skip qtwebsockets                                                      \
            -skip qtwebview                                                         \
            -skip qtx11extras                                                       \
            -no-warnings-are-errors                                                 \
            -prefix ~/android/env/x86_64/21
        

        I have added ~/android/env/x86_64/21/bin/qmake to the Qt Creator kit, but when I try to create any project in QMake, it uses android-16 API level instead of 21, resulting in an error:

        /home/markand/android/ndk/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-g++ -c -D__ANDROID_API__=16 --sysroot=/home/markand/android/ndk/platforms/android-16/arch-x86_64/ -isystem /home/markand/android/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/markand/android/ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include -fstack-protector-strong -DANDROID -O2 -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../save-the-ball -I. -I../../android/env/x86_64/21/include -I../../android/env/x86_64/21/include/QtWidgets -I../../android/env/x86_64/21/include/QtGui -I../../android/env/x86_64/21/include/QtCore -I. -I../../android/env/x86_64/21/mkspecs/android-g++ -o main.o ../save-the-ball/main.cpp
        

        If I specify qmake ANDROID_PLATFORM=android-21 on command line the Makefile gets fixed. But I have no ideas why Qt Creator still uses 16 by default.

        R Offline
        R Offline
        raven-worx
        Moderators
        wrote on 6 Jun 2018, 11:48 last edited by
        #3

        @David-Demelier
        you probably havent setup the Android environment correctly in the QtCreator settings?

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • D Offline
          D Offline
          David Demelier
          wrote on 6 Jun 2018, 15:13 last edited by David Demelier 6 Jun 2018, 15:29
          #4

          In fact I've realized there is an environment variable set in Qt Creator, I can view it from Projects -> Build -> Build environment which has ANDROID_NDK_PLATFORM set to android-16. I wonder where this variable comes from though.

          Set to android-21 works correctly. I will probably clone the kit to add it as environment variable but it would be nice to understand why it is set incorrectly first.

          Edit: no it didn't work, it worked because I have ran qmake by hand in the terminal, but a rebuild cause the same issue in Qt Creator.

          1 Reply Last reply
          0

          1/4

          6 Jun 2018, 11:43

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved