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. Using .dll , .lib or.so file in android project

Using .dll , .lib or.so file in android project

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 327 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.
  • A Offline
    A Offline
    AllenMvi
    wrote on last edited by
    #1

    Hello, I recently got into the developing of Android applications, and I don't know how to use the .dll or .so files that are used in desktop applications here. So far, I have successfully run a simple Android program on my Qt emulator, but as soon as I added .dll or .so to CMake, I encountered build and configuration issues.
    The lib that i want to use is vosk-api

    My OS: Windows 10
    Qt version: 6.6.1
    CMake version: 29

    • Using .dll file Build output:
      22e751f4-1f87-45ac-95d0-293afbe9e07b-image.png

    • Using .lib file Build output:
      dfdb2042-6b7a-48ba-8df0-ef84772253c5-image.png

    • Using .so file Build output:
      49d69c35-3f28-4b8e-901b-eeeda6a8f177-image.png

    • My android kit:
      1079631e-6960-46c4-8df6-bf30ddf37ab8-image.png

    • My Devices setting:
      acc8bee4-9f9d-4c8b-8107-f3033003d9e7-image.png

    • f711e22a-a3a2-4fd5-ad16-f48f5fc39d1a-image.png

    • Cmake code:

    cmake_minimum_required(VERSION 3.16)
    
    project(SpeachToText VERSION 0.1 LANGUAGES CXX)
    
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    find_package(Qt6 6.2 COMPONENTS Core Quick Multimedia REQUIRED)
    
    set(PROJECT_SOURCES
            main.cpp
            Microphon.cpp
            Microphon.h
            qml.qrc
            ./includs/vosk_api.h
    )
    
    qt_add_executable(SpeachToText
        ${PROJECT_SOURCES}
    )
    
    set(LIB_DIR ${CMAKE_SOURCE_DIR}/libs)
    include_directories(${CMAKE_SOURCE_DIR}/include)
    
    set_target_properties(SpeachToText PROPERTIES
        MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
        MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
        MACOSX_BUNDLE TRUE
        WIN32_EXECUTABLE TRUE
    )
    
    target_link_libraries(SpeachToText
        PRIVATE Qt6::Core Qt6::Quick Qt6::Multimedia ${LIB_DIR}/libvosk.so)
    
    include(GNUInstallDirs)
    install(TARGETS SpeachToText
        BUNDLE DESTINATION .
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      Might be a sill question but: did you build that library for Androïd ?

      It seems like it but I am not completely sure.

      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
      • A Offline
        A Offline
        AllenMvi
        wrote on last edited by
        #3

        Yes, I tested it with the output from the GitHub repository, but that file is in .so format. Do you think I must use Linux to develop this program?

        https://github.com/alphacep/vosk-api/releases/download/v0.3.45/vosk-android-0.3.45.zip

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

          You shouldn't need to switch to Linux.
          What is strange is that the error message seems to indicate that the .so file is not in the path you gave.

          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
          • A Offline
            A Offline
            AllenMvi
            wrote on last edited by
            #5

            I solved it, the problem is with my kit, i changed it to default setting.

            1 Reply Last reply
            0
            • A AllenMvi has marked this topic as solved on

            • Login

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