how to deploy custom lib on Android (encrypted sqlite)
-
wrote on 7 Feb 2018, 19:48 last edited by
I don't know where to put a custom lib, so that it will get wrapped up in the Android .apk, then get linked properly on the device.
I've cross-compiled libsqlite.so with the Android NDK. And, as near as I can tell, Qt\5.9.x/android_armv7/plugins/sqldrivers/libqsqlite.so is expecting to link to the Android version on the device.
I see some old advice ( https://groups.google.com/forum/#!topic/android-qt/k7sIjiFKO6E ) that suggests using addLibraryPath() which makes sense. But, I'm missing what path in the Qt code? Android code? to put my custom lib, and how to identify the library path to add on the device.
Any tips?
(incidentally, I'll have to bang on this for iOS, too) -
Use this in your .pro file:
ANDROID_EXTRA_LIBS = /path/to/your/lib.so
The path should be from your PC (so the build tool can find it and merge into the .apk).
It is also possible to specify the library in Qt Creator's gui - see Project -> Build -> Build Android APK -> Additional libraries
-
Hi,
An alternative could to build your custom sqlite statically and then rebuild the Qt SQLite plugin against than one. This way you don't have to us an additional library.
-
Use this in your .pro file:
ANDROID_EXTRA_LIBS = /path/to/your/lib.so
The path should be from your PC (so the build tool can find it and merge into the .apk).
It is also possible to specify the library in Qt Creator's gui - see Project -> Build -> Build Android APK -> Additional libraries
-
@sierdzio Thanks! I'll give that a try.
Will I then need to addLibraryPath() , or will it have been added automatically?
-
Nice :) Happy further coding!
... and before you ask - I don't know how to do the same on iOS. I know that using LIBS works, but I guess that does not count for plugins.
1/6