Solved Using Qt based shared library with the Android NDK
-
Hi everyone!
I'm trying to use a custom shared library that used Qt in an Android NDK project.
I already manage to include the library inside the Android Studio, but when I compile the App the compiler cannot find the Qt's libraries in my system.
Is there any way I can configure my project to use the Qt directory and include the Qt library
Thanks -
@Antonio-Ortiz You can start here https://doc.qt.io/qt-5/android.html
-
Thanks, @jsulm.
But that documentation is not helpful. I don't need to compile an application for Android, I need to use a custom Qt library inside an Android project. -
I'm not ultra confident in my answer, so take it with a grain of salt...
Hopefully you (@Antonio-Ortiz ) are able to compile the "custom shared library that used Qt" manually.
If you are, then when you compile this custom shared library, I think you will want to link it statically to Qt.
It sounds like your Android project does find the custom library, but it then fails to find the transitive dependencies of it. Hence my suggestion (which I have not attempted). I figure that if you make the custom library "bake in" (statically) all its dependencies, then the problem disappears because there are no transitive dependencies needed.
But this is just me thinking generically about generic cases of compiling arbitrary c/c++ code. I realize there are numerous restrictions and other trade-offs that enter the picture when we deal with "opinionated" frameworks and IDE(s). That's why I'm not 100% sure that what I propose is feasible.
Another thought: I think you might need to post in a forum or mailing list for Android studio experts. I would never discourage you from coming here first (this community is phenomenal!). But I think the problem of configuring your Android project (which is not itself Qt based, right?).... configuring that Android project to find transitive third-party dependencies of a custom library... this feels like a question for Android experts more so than Qt experts.
-
@KH-219Design said in Using Qt based shared library with the Android NDK:
ion for And
Thanks for your answer.
Yes, compile the shared library and link statically Qt could be the solution. I'll give it a try.
The only thing that worries me is any licensing issues. I'll mark this thread as solved.