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. How to Use Qt6 libraries in android studio ndk?
Forum Updated to NodeBB v4.3 + New Features

How to Use Qt6 libraries in android studio ndk?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
ndkandroidcmakeqt6
2 Posts 2 Posters 6.1k 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.
  • M Offline
    M Offline
    mesutkokalan
    wrote on 14 Dec 2022, 17:44 last edited by
    #1

    I want to use Qt6 Core library in my android studio ndk project. Despite of many attempts I have failed. Please guide me how to use Qt6 libraries in android studio ndk project.

    Qt6 installation directory: "C:\Qt"
    

    And the path "C:\Qt\6.4.1" directory contains the following files and folders:

    14.12.2022  18:32    <DIR>          .
    14.12.2022  18:32    <DIR>          ..
    10.11.2022  18:12    <DIR>          android_arm64_v8a
    10.11.2022  18:16    <DIR>          android_armv7
    10.11.2022  18:19    <DIR>          android_x86
    10.11.2022  18:21    <DIR>          android_x86_64
    10.11.2022  17:47    <DIR>          Logs
    10.11.2022  16:04    <DIR>          mingw_64
    10.11.2022  16:33    <DIR>          msvc2019_64
    10.11.2022  17:11    <DIR>          msvc2019_arm64
    14.12.2022  18:32                 0 output.txt
    10.11.2022  17:47             2.084 sha1s.txt
    10.11.2022  17:47    <DIR>          Src
    10.11.2022  18:25    <DIR>          wasm_32
                   2 File(s)          2.084 bytes
                  12 Dir(s)  230.990.303.232 bytes free
    

    Please note that it doesn't contain CMakeLists.txt.

    I tried the following steps and failed at all.

    Step1:

    # CMakeLists.txt
    cmake_minimum_required(VERSION 3.21.1)
    project(test)
    
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    list(APPEND CMAKE_PREFIX_PATH "C:/Qt/6.4.1")
    list(APPEND CMAKE_PREFIX_PATH "C:/Qt/6.4.1/mingw_64/")
    
    find_packgggage(Qt6 REQUIRED COMPONENTS Core)
    
    add_library(test-lib SHARED native-lib.cpp)
    target_link_libraries(test-lib Qt6::Core)
    

    Step2:

    # CMakeLists.txt
    cmake_minimum_required(VERSION 3.21.1)
    project(test)
    
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    add_library(test-lib SHARED native-lib.cpp)
    
    include_directories(test-lib "C:/Qt/6.4.1/mingw_64/include")
    
    target_link_libraries(test-lib
            "C:/Qt/6.4.1/mingw_64/lib/libQt6Core.a"
            )
    

    All the steps above failed. How to overcome this? Any helps would be very appreciated.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JoeCFD
      wrote on 14 Dec 2022, 17:49 last edited by JoeCFD
      #2

      Are you using Qt build for android? It is normally under android_* dir and is different from normal build.

      1 Reply Last reply
      0

      2/2

      14 Dec 2022, 17:49

      • Login

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