Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

use qt5.15.0.1 and cmake to create android project error



  • I want to use cmake to create android project in ubuntu 18.04 x64. So i use Qt creator create a Non-Qt Project with cmake build system. But it shows error. Could someone tell me how to solve it?
    The error info is:
    Running /home/ubuntu/software/Qt/Tools/CMake/bin/cmake -S /home/ubuntu/work/android_program/test_create_empty_demo -B /tmp/QtCreator-qvJEWw/qtc-cmake-NjfScPNk -GNinja -DCMAKE_BUILD_TYPE:String=Debug -DQT_QMAKE_EXECUTABLE:STRING=/home/ubuntu/software/Qt/5.15.1/android/bin/qmake -DCMAKE_PREFIX_PATH:STRING=/home/ubuntu/software/Qt/5.15.1/android -DCMAKE_C_COMPILER:STRING=/home/ubuntu/software/android/android_studio_sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -DCMAKE_CXX_COMPILER:STRING=/home/ubuntu/software/android/android_studio_sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -DANDROID_NATIVE_API_LEVEL:STRING=16 -DANDROID_NDK:PATH=/home/ubuntu/software/android/android_studio_sdk/ndk/21.1.6352462 -DCMAKE_TOOLCHAIN_FILE:PATH=/home/ubuntu/software/android/android_studio_sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake -DANDROID_ABI:STRING=armeabi-v7a -DANDROID_SDK:PATH=/home/ubuntu/software/android/android_studio_sdk -DANDROID_STL:STRING=cxx_shared -DCMAKE_FIND_ROOT_PATH:PATH=/home/ubuntu/software/Qt/5.15.1/android in /tmp/QtCreator-qvJEWw/qtc-cmake-NjfScPNk.
    -- Configuring incomplete, errors occurred!
    CMake Error at /home/ubuntu/software/android/android_studio_sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake:377 (message):
    Invalid Android STL: cxx_shared.
    Call Stack (most recent call first):
    /home/ubuntu/software/Qt/Tools/CMake/share/cmake-3.17/Modules/CMakeDetermineSystem.cmake:93 (include)
    CMakeLists.txt:3 (project)

    CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake process exited with exit code 1.
    Elapsed time: 00:00.

    2020-09-13 13-17-03 的屏幕截图.png



  • After set cmake Initial CMake parameters is "-DANDROID_STL:STRING=c++_static", compile ok


Log in to reply