Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-20419

Can't build Qt application for Android

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.6.1
    • Labels:
      None
    • Environment:
      Ubuntu 18.04

      java version "1.8.0_171"
      Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
      Java HotSpot(TM) Server VM (build 25.171-b11, mixed mode)
    • Commits:
      Iea6b1720c64810c490e4c9876ecb5ff8c8a9a935

      Description

      I built Qt for Android following the instructions at https://wiki.qt.io/Android. The build finished successfully, but when I try to build a basic Qt Quick application, I get the following error message:

      14:46:08: Running steps for project quick...
      14:46:08: Configuration unchanged, skipping qmake step.
      14:46:08: Starting: "/usr/bin/make" -j 8
      make: Nothing to be done for 'first'.
      14:46:08: The process "/usr/bin/make" exited normally.
      14:46:08: Running steps for project quick...
      14:46:08: Configuration unchanged, skipping qmake step.
      14:46:08: Starting: "/home/mitch/dev/Android/android-ndk-r10e/prebuilt/linux-x86_64/bin/make" -j 8
      /home/mitch/dev/Android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=15 --sysroot=/home/mitch/dev/Android/android-ndk-r10e/platforms/android-15/arch-arm/ -isystem /home/mitch/dev/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/mitch/dev/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -marm -O0 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../quick -I. -I../../qt5-dev-android-debug/qtbase/include -I../../qt5-dev-android-debug/qtbase/include/QtQuick -I../../qt5-dev-android-debug/qtbase/include/QtGui -I../../qt5-dev-android-debug/qtbase/include/QtQml -I../../qt5-dev-android-debug/qtbase/include/QtNetwork -I../../qt5-dev-android-debug/qtbase/include/QtCore -I. -I../../qt5-dev/qtbase/mkspecs/android-g++ -o main.o ../quick/main.cpp
      In file included from ../../qt5-dev-android-debug/qtbase/include/QtCore/qglobal.h:1:0,
                       from ../../qt5-dev-android-debug/qtbase/include/QtGui/../../../../qt5-dev/qtbase/src/gui/kernel/qtguiglobal.h:43,
                       from ../../qt5-dev-android-debug/qtbase/include/QtGui/qtguiglobal.h:1,
                       from ../../qt5-dev-android-debug/qtbase/include/QtGui/../../../../qt5-dev/qtbase/src/gui/kernel/qguiapplication.h:43,
                       from ../../qt5-dev-android-debug/qtbase/include/QtGui/qguiapplication.h:1,
                       from ../../qt5-dev-android-debug/qtbase/include/QtGui/QGuiApplication:1,
                       from ../quick/main.cpp:1:
      ../../qt5-dev-android-debug/qtbase/include/QtCore/../../../../qt5-dev/qtbase/src/corelib/global/qglobal.h:50:22: fatal error: assert.h: No such file or directory
       #  include <assert.h>
                            ^
      compilation terminated.
      make: *** [main.o] Error 1
      14:46:08: The process "/home/mitch/dev/Android/android-ndk-r10e/prebuilt/linux-x86_64/bin/make" exited with code 2.
      Error while building/deploying project quick (kit: qt5-dev-android-debug)
      When executing step "Make"
      14:46:08: Elapsed time: 00:00.
      

      The build script:

      #! /bin/bash
      
      qtBuildDir=~/dev/qt5-dev-android-debug
      qtSourceDir=~/dev/qt5-dev
      
      set -e
      
      if [ ! -d "$qtSourceDir" ]; then
          echo "source directory $qtSourceDir doesn't exist; aborting"
          exit
      fi
      
      if [ ! -d "$qtBuildDir" ]; then
          echo "build directory $qtBuildDir doesn't exist; aborting"
          exit
      fi
      
      rm -fr $qtBuildDir
      mkdir $qtBuildDir
      cd $qtBuildDir
      
      $qtSourceDir/configure -v -debug -developer-build -opensource -confirm-license -xplatform android-g++ -nomake tests -nomake examples -android-ndk-platform android-21 -android-ndk /home/mitch/dev/Android/android-ndk-r10e -android-sdk /home/mitch/dev/Android/Sdk -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -no-warnings-are-errors
      
      make -j 8
      

      I installed the r10e NDK and I have API level 21 installed from the SDK manager.

      If I download Qt 5.9.5 for Android from the online installer and build the same application, I get a similar error:

      14:59:20: Running steps for project quick...
      14:59:20: Configuration unchanged, skipping qmake step.
      14:59:20: Starting: "/usr/bin/make" -j 8
      make: Nothing to be done for 'first'.
      14:59:20: The process "/usr/bin/make" exited normally.
      14:59:20: Running steps for project quick...
      14:59:20: Configuration unchanged, skipping qmake step.
      14:59:20: Starting: "/home/mitch/dev/Android/android-ndk-r10e/prebuilt/linux-x86_64/bin/make" 
      /home/mitch/dev/Android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=15 --sysroot=/home/mitch/dev/Android/android-ndk-r10e/platforms/android-15/arch-arm/ -isystem /home/mitch/dev/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/mitch/dev/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -marm -O0 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../quick -I. -I../../qt-unified/5.9.5/android_armv7/include -I../../qt-unified/5.9.5/android_armv7/include/QtQuick -I../../qt-unified/5.9.5/android_armv7/include/QtGui -I../../qt-unified/5.9.5/android_armv7/include/QtQml -I../../qt-unified/5.9.5/android_armv7/include/QtNetwork -I../../qt-unified/5.9.5/android_armv7/include/QtCore -I. -I../../qt-unified/5.9.5/android_armv7/mkspecs/android-g++ -o main.o ../quick/main.cpp
      In file included from /home/mitch/dev/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_algo.h:59:0,
                       from /home/mitch/dev/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/algorithm:62,
                       from ../../qt-unified/5.9.5/android_armv7/include/QtCore/qglobal.h:109,
                       from ../../qt-unified/5.9.5/android_armv7/include/QtGui/qtguiglobal.h:43,
                       from ../../qt-unified/5.9.5/android_armv7/include/QtGui/qguiapplication.h:43,
                       from ../../qt-unified/5.9.5/android_armv7/include/QtGui/QGuiApplication:1,
                       from ../quick/main.cpp:1:
      /home/mitch/dev/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/cstdlib:72:20: fatal error: stdlib.h: No such file or directory
       #include <stdlib.h>
                          ^
      compilation terminated.
      make: *** [main.o] Error 1
      14:59:20: The process "/home/mitch/dev/Android/android-ndk-r10e/prebuilt/linux-x86_64/bin/make" exited with code 2.
      Error while building/deploying project quick (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.9.5 for Android armv7))
      When executing step "Make"
      14:59:20: Elapsed time: 00:00.
      

      I notice that Creator sets ANDROID_NDK_PLATFORM to android-15 in the Build Environment, which doesn't seem right. I don't have android-15. Notice that -D_ANDROID_API_=15 is passed when building using both kits.

      ls ~/dev/Android/android-ndk-r10e/platforms/
      android-12  android-15  android-21  android-3  android-8  android-9
      

      If I check Tools > Options > Devices > Android > Android Settings, it says:

      Android settings are OK. (SDK Version: 26.1.1, NDK Version: 10.4.0)

      That doesn't seem right? I only have Android 5.0 (Lollipop, API level 21, revision 2) installed. I did have newer versions installed (see this discussion) that I've since removed.

        Attachments

        1. android_1.zip
          67 kB
        2. quick.tar.xz
          57 kB
        3. sdkmanager.txt
          1 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              • Assignee:
                vikas Vikas Pachdha
                Reporter:
                mitch_curtis Mitch Curtis
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes