QMake uses android-16 API level instead of android-21
-
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.
-
@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)..
-
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.
@David-Demelier
you probably havent setup the Android environment correctly in the QtCreator settings? -
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.