Using .dll , .lib or.so file in android project
-
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-apiMy OS: Windows 10
Qt version: 6.6.1
CMake version: 29-
Using .dll file Build output:
-
Using .lib file Build output:
-
Using .so file Build output:
-
My android kit:
-
My Devices setting:
-
-
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})
-
-
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.
-
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
-
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.