[SOLVED] Qt sql database driver not loaded in android
I'm developing an app suign Qt for android. This app need to use the sqlite engine. It work perfect under windows but when I move to android the following error come up and no possibility to use database:
W/Qt ( 1017): kernel\qsqldatabase.cpp:785 (void QSqlDatabasePrivate::init(const QString&)): QSqlDatabase: QSQLITE driver not loaded
W/Qt ( 1017): kernel\qsqldatabase.cpp:786 (void QSqlDatabasePrivate::init(const QString&)): QSqlDatabase: available drivers:
W/Qt ( 1017): kernel\qsqldatabase.cpp:789 (void QSqlDatabasePrivate::init(const QString&)): QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
Someone can help in fixing this issue? I verified the .so sqlite plugin is present into the folder with all other Qt .so libraries. Googling around for similar problem I found someone who suggest to add the path of the libraries at application startup but doesn't work for me. Currently no workaround found...
Found the problem here. Basically I initialized my QSqlDatabase object inside the costructor of a private class. It work on Windows but it seem when compiled and ran for android the creation of this class was made before the main QApplication class. This cause the issue the QSqlDatabase try to load driver before the main app class was ready and fail...
it is great that you have solved the issue on your own and shared the solution :)
Could you please edit the title of the thread and append [SOLVED] as prefix to it? Right now there is no other mechanism to mark solved issues at the forum.
You right, just done. Very sorry I didn't though before. ^_^
[quote author="Suppaman" date="1393851121"]Hi
You right, just done. Very sorry I didn't though before. ^_^[/quote]
Thanks :) I hope that in future more convenient and efficient ways to mark threads as solved and to highlight good answers will be implemented at Qt Project's website :)