Qt SQLite plugin exists but is not recognized as available sql driver

875 views
Skip to first unread message

Julian

unread,
Dec 9, 2011, 8:39:22 PM12/9/11
to android-qt
hi everyone.

i'm currently struggling with the Qt SQLite plugin on android (coming
with Ministro II). the plugin lib certainly exists:
when i start my application, it prints "[...] QT_PLUGIN_PATH=/data/
data/org.kde.necessitas.ministro/files/qt/plugins [...]" (check with
adb logcat).
in that directory, libqsqlite.so exists, checked via adb shell:
"# ls /data/data/org.kde.necessitas.ministro/files/qt/plugins/
sqldrivers
ls /data/data/org.kde.necessitas.ministro/files/qt/plugins/sqldrivers
libqsqlite.so
#"

but upon application start, i also get the following message:
"W/Qt ( 724): QSqlDatabase: QSQLITE driver not loaded
W/Qt ( 724): QSqlDatabase: available drivers:
D/Qt ( 724): createPlatformWindow false"
so obviously, the plugin is there but it isn't recognized by the QtSql
module or by my application.

another thing i tried was to copy libqsqlite to my application's lib
directory and add that directory via QCoreApplication::addLibraryPath
but that didn't change anything.
also, copying libqsqlite.so to /data/local/qt/plugins/sqldrivers
didn't effect the outcome.

am i doing something wrong or have i forgotten any necessary steps?
i'd be thankful for any tips i get regarding this. until then, i'll
keep on googling ...
thanks a lot in advance!

sincerely
julian

Jonny

unread,
Dec 21, 2011, 3:47:36 PM12/21/11
to android-qt
Hi Julian,
Did you have any success with this?
I read some older posts around here about patching the QtActivity.java
file to install the QtSqlite plugin, but I believe that it is no
longer possible to do this with the new necessitas SDK...
I am not sure where to begin to troubleshoot this issue yet...
Cheers,
Jon

noname

unread,
Dec 21, 2011, 4:21:08 PM12/21/11
to andro...@googlegroups.com
oh sorry i didn't reply yet ...
yes i did manage to make our app work with the QtSqlite plugin.
after fixing some other problems with our code, it basically came down
to this:
qApp->addLibraryPath("/data/data/org.kde.necessitas.ministro/files/qt/plugins");
(at the top of main(), first instruction after the creation of a
QApplication)

i initially didn't realize that Qt looks for each plugin in its
appropriate subdir
(sqldrivers for example), even if it's not in the default plugin path but in
any of the specified library paths. silly me ... was kinda obvious actually.

anyways, i hope this helps.

btw. i didn't really get what you were saying about patching QtActivity.java
"to install the QtSqlite plugin" ... the qt-sqlite-plugin (libqsqlite.so
i think)
comes with Ministro (last time i tried it, at least) and should be found in
"/data/data/org.kde.necessitas.ministro/files/qt/plugins/sqldrivers".
you could check if its really there if the problem persists (using adb shell
or something).

kind regards
julian

Jonny

unread,
Dec 21, 2011, 4:46:18 PM12/21/11
to android-qt
Thanks Julian!
That did the trick!
Cheers,
Jon

chuen

unread,
Dec 21, 2011, 10:23:32 PM12/21/11
to android-qt
I have encountered the same problem, I added this line in my code, it
works very well!

qApp->addLibraryPath("/data/data/org.kde.necessitas.ministro/files/qt/
plugins");

Thks so much!

On 12月22日, 上午5时46分, Jonny <jhe...@snappyappz.com> wrote:
> Thanks Julian!
> That did the trick!
> Cheers,
> Jon
>
> On Dec 21, 4:21 pm, noname <freek...@gmx.de> wrote:
>
>
>
>
>
>
>
> > oh sorry i didn't reply yet ...
> > yes i did manage to make our app work with the QtSqlite plugin.
> > after fixing some other problems with our code, it basically came down
> > to this:
> > qApp->addLibraryPath("/data/data/org.kde.necessitas.ministro/files/qt/plugi ns");
Reply all
Reply to author
Forward
0 new messages