Solved Android: QSqlitePlugin crashing application on Android device. Why?
-
Hello all!
I've done it for iOS and MacOS but I've got issue on Android device with QtCipherSqlitePlugin. It's not working under Android. I've done everything that is in instruction.
It's in *.pro file
LIBS += -L$$[QT_INSTALL_PLUGINS]/sqldrivers -lsqlitecipher
and adding at time of building
Reading Android dependencies for Qt5Sql Appending dependency from xml: plugins/sqldrivers/libqsqlite.so Appending dependency from xml: plugins/sqldrivers/libsqlitecipher.so
But when it's starting on device it's crashing with this message:
E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread E AndroidRuntime: Process: org.qtproject.example, PID: 5033 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libsqlitecipher.so" not found E AndroidRuntime: at java.lang.Runtime.load0(Runtime.java:897) E AndroidRuntime: at java.lang.System.load(System.java:1505) E AndroidRuntime: at org.qtproject.qt5.android.QtNative$4.run(QtNative.java:259) E AndroidRuntime: at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87) E AndroidRuntime: at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61) E AndroidRuntime: at java.lang.Thread.run(Thread.java:761)
What am I missing?
-
Hi,
Looks like you are not deploying the plugin. Since it's not an official plugin, you likely shall manually add it to the list of things to deploy.
-
All library that using by application should be added manually into Android application. There are too possible ways:
- Through build settings "Build Android APK"
- Add "ANDROID_EXTRA_LIBS +=" into *.pro file, something like this:
equals(ANDROID_TARGET_ARCH,x86) { LIBS += -L$$PWD/libs/OpenSSL/lib/android/x86/lib/ -lcrypto LIBS += -L$$PWD/libs/OpenSSL/lib/android/x86/lib/ -lssl LIBS += -L$$PWD/libs/SqliteCipher/lib/android_x86/sqlitecipher/plugins/sqldrivers/ -lsqlitecipher ANDROID_EXTRA_LIBS += $$PWD/libs/OpenSSL/lib/android/x86/lib/libcrypto.so ANDROID_EXTRA_LIBS += $$PWD/libs/OpenSSL/lib/android/x86/lib/libssl.so ANDROID_EXTRA_LIBS += $$PWD/libs/SqliteCipher/lib/android_x86/sqlitecipher/plugins/sqldrivers/libsqlitecipher.so }