Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. building qt 5.9 on windows for android results in 'ERROR: Cannot detect Android NDK toolchain'
Forum Updated to NodeBB v4.3 + New Features

building qt 5.9 on windows for android results in 'ERROR: Cannot detect Android NDK toolchain'

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
17 Posts 2 Posters 2.8k Views 1 Watching
  • 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
    deveLoper5122
    wrote on last edited by
    #1

    I followed the build instructions from here :
    https://wiki.qt.io/Building_qt-android_on_windows

    and created my bat file to ease the operation

    set "MINGW_BUILDS_ROOT=C:\mingw64"
    set "JDK_ROOT=E:\programs\AndStdio\jre"
    set "ANDROID_NDK_PATH=E:\programs\AndNdk"
    set "ANDROID_SDK_PATH=E:\programs\AndSdk2"
    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_TOOLCHAIN_VERSION=4.9"
    set "ANDROID_NDK_HOST=windows-x86_64"
    set "PATH=%MINGW_BUILDS_ROOT%\bin;%PATH%"
    configure.bat -developer-build -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 -prefix E:\qt-android
    

    but I got :

    Bootstrapping qmake ...
    mingw32-make: Nothing to be done for 'first'.
    ERROR: Cannot detect Android NDK toolchain.
    Please use -android-toolchain-version to specify it.
    

    I'm using android-ndk-r17b-windows-x86_64 downloaded from https://dl.google.com/android/repository/android-ndk-r17b-windows-x86_64.zip and can successfully build android apps with visualgdb in visual studio

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Please also take a look at this wiki entry linked from Qt's documentation. You should try with NDK r10. The more recent versions proven problematic as explained there.

      You might have success with r17 with a more recent version of Qt.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        deveLoper5122
        wrote on last edited by
        #3

        but what are the more recent versions , I'm currently using qt 5.9
        I'll try with ndk r10 and post the result

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deveLoper5122
          wrote on last edited by
          #4

          the same problem with ndk 10
          this is my bat file :

          @echo off
          set "MINGW_BUILDS_ROOT=C:\mingw64"
          set "JDK_ROOT=E:\programs\AndStdio\jre"
          set "ANDROID_NDK_PATH=E:\programs\NDK10"
          set "ANDROID_SDK_PATH=E:\programs\AndSdk2"
          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_TOOLCHAIN_VERSION=4.9"
          set "ANDROID_NDK_HOST=windows-x86_64"
          set "PATH=%MINGW_BUILDS_ROOT%\bin;%PATH%"
          configure.bat -developer-build -platform win32-g++ -opengl es2 -xplatform android-g++ -android-ndk ANDROID_NDK_PATH -android-toolchain-version 4.9 -android-sdk ANDROID_SDK_ROOT -opensource -confirm-license -nomake tests -nomake examples -prefix E:\qt-android
          

          and the output is :

          Bootstrapping qmake ...
          mingw32-make: Nothing to be done for 'first'.
          ERROR: Cannot detect Android NDK toolchain.
          Please use -android-toolchain-version to specify it.
          
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Out of curiosity, why not use a pre-built version ?

            You can make the configure script more verbose adding the -v option.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • D Offline
              D Offline
              deveLoper5122
              wrote on last edited by
              #6

              the problem was in this : "-android-ndk ANDROID_NDK_PATH" I had to provide the full path or use %ANDROID_NDK_PATH% as the string was passed as it is not as an environment variable
              I think the error should be : can't find ndk path

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                So you succeed building Qt ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  deveLoper5122
                  wrote on last edited by
                  #8

                  I now started the build with mingw32-make and the build will take some time

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    deveLoper5122
                    wrote on last edited by
                    #9

                    got this error during build

                    E:/programs/NDK10/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=E:/programs/NDK10/platforms/android-16/arch-arm/ -isystem E:/programs/NDK10/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem E:/programs/NDK10/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 -fPIC -std=c++14 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -Wno-error=literal-suffix -D_REENTRANT -DQT_NO_CAST_FROM_ASCII -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_FONTDATABASE_SUPPORT_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../../include -I../../../include/QtFontDatabaseSupport -I../../../include/QtFontDatabaseSupport/5.9.2 -I../../../include/QtFontDatabaseSupport/5.9.2/QtFontDatabaseSupport -I../../../include/QtGui/5.9.2 -I../../../include/QtGui/5.9.2/QtGui -I../../../include/QtCore/5.9.2 -I../../../include/QtCore/5.9.2/QtCore -I../../../include/QtGui -I../../../include/QtCore -I.moc -I../../3rdparty/freetype/include -I../../../mkspecs/android-g++ -o .obj/qfreetypefontdatabase.obj freetype/qfreetypefontdatabase.cpp
                    In file included from freetype/qfreetypefontdatabase.cpp:51:0:
                     ../../../include/QtFontDatabaseSupport/5.9.2/QtFontDatabaseSupport/private/qfontengine_ft_p.h:1:88: fatal error: ../../../../../src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h: No such file or directory
                    #include "../../../../../src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h"
                                                                                                        ^
                    compilation terminated.
                    
                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Did you check if you have that file somewhere ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        deveLoper5122
                        wrote on last edited by
                        #11

                        @deveLoper5122 said in building qt 5.9 on windows for android results in 'ERROR: Cannot detect Android NDK toolchain':

                        qfontengine_ft_p

                        I have it in E:\qt-android-source\qt-everywhere-opensource-src-5.9.2\qt-everywhere-opensource-src-5.9.2\qtbase\src\platformsupport\fontdatabases\freetype

                        but don't know why the compiler didn't resolve it

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          That's a pretty long path for not much benefit.

                          I'd recommend shortening it and also make an out of source build.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            deveLoper5122
                            wrote on last edited by
                            #13

                            I can't change the dir now after I started building , I had to rebuild from scratch again right ?

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              Yes, that's correct.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                deveLoper5122
                                wrote on last edited by
                                #15

                                I could change the dir with a symbol link to qt base and resumed the build again

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  deveLoper5122
                                  wrote on last edited by
                                  #16

                                  but now I got :

                                  javac -source 6 -target 6 -Xlint:unchecked -bootclasspath E:/programs/AndSdk2/platforms/android-25/android.jar -cp 'E:\qt-android-source\qt-5.9.2\qt-5.9.2\qtbase\src\android\jar\src\;E:\programs\AndSdk2\platforms\android-25\android.jar' -d .classes.bundled src/org/qtproject/qt5/android/accessibility/QtAccessibilityDelegate.java src/org/qtproject/qt5/android/accessibility/QtNativeAccessibility.java src/org/qtproject/qt5/android/QtActivityDelegate.java src/org/qtproject/qt5/android/QtEditText.java src/org/qtproject/qt5/android/QtInputConnection.java src/org/qtproject/qt5/android/QtLayout.java src/org/qtproject/qt5/android/QtMessageDialogHelper.java src/org/qtproject/qt5/android/QtNative.java src/org/qtproject/qt5/android/QtNativeLibrariesDir.java src/org/qtproject/qt5/android/QtSurface.java src/org/qtproject/qt5/android/ExtractStyle.java src/org/qtproject/qt5/android/EditMenu.java src/org/qtproject/qt5/android/EditPopupMenu.java src/org/qtproject/qt5/android/CursorHandle.java
                                  process_begin: CreateProcess(NULL, javac -source 6 -target 6 -Xlint:unchecked -bootclasspath E:/programs/AndSdk2/platforms/android-25/android.jar -cp E:\qt-android-source\qt-5.9.2\qt-5.9.2\qtbase\src\android\jar\src\;E:\programs\AndSdk2\platforms\android-25\android.jar -d .classes.bundled src/org/qtproject/qt5/android/accessibility/QtAccessibilityDelegate.java src/org/qtproject/qt5/android/accessibility/QtNativeAccessibility.java src/org/qtproject/qt5/android/QtActivityDelegate.java src/org/qtproject/qt5/android/QtEditText.java src/org/qtproject/qt5/android/QtInputConnection.java src/org/qtproject/qt5/android/QtLayout.java src/org/qtproject/qt5/android/QtMessageDialogHelper.java src/org/qtproject/qt5/android/QtNative.java src/org/qtproject/qt5/android/QtNativeLibrariesDir.java src/org/qtproject/qt5/android/QtSurface.java src/org/qtproject/qt5/android/ExtractStyle.java src/org/qtproject/qt5/android/EditMenu.java src/org/qtproject/qt5/android/EditPopupMenu.java src/org/qtproject/qt5/android/CursorHandle.java, ...) failed.
                                  make (e=2): The system cannot find the file specified.
                                  
                                  1 Reply Last reply
                                  0
                                  • D Offline
                                    D Offline
                                    deveLoper5122
                                    wrote on last edited by
                                    #17

                                    the file exists but the javac doesn't seem to be redircted with the symbol link so I have to restart the whole build with a shorter path

                                    1 Reply Last reply
                                    0

                                    • Login

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