I developed a c++ library using qt. In this one I am using QSqlDatabase to query informations from a SQLite database. Notice : my library works fine in a qt desktop application (I am developing on Linux).
My program written in Qt C calls the sqlite database. On my own computer it works good, but on the end user's computer it says 'Driver not loaded'. True, I don't know which files/dlls should be c. Qt - QSQLDatabase (using SQLite) takes long time to open a database; Qt QPSQL driver not loaded; Qt MySQL can't load plugin driver (QLibrary, QPluginLoader successfully loaded, QSqlDatabase::drivers return empty!) qt - How to deliver sqlite driver to the end user?
Now my next step is to use my libray in an android studio project. For this I compiled my library using the android ndk (this step works fine) but got QSqlDatabase : Driver not loaded Driver not loaded.
This error occurs when I am calling m_database.setDatabaseName(/Database.db);
Thank for your feedback
2 Answers
The error message says it all : the driver is not loaded.
In your case, the SQLite database driver is not loaded.
This can be because of :
- you didn't compile the SQLite Qt driver
- the SQLite Qt driver is compiled, but not deployed
- the SQLite Qt driver is deployed, but not found by Qt
Have a look here, in 'Troubleshooting' section : http://doc.qt.io/qt-5/sql-driver.html
I'm not a pro in Android, but documentatin can be easily found :
Search for 'sql' and 'deploy' in these pages
I finally resolved my problem. Qt did not found the driver in the tree folder of the apk (once deployed on a device)
Have a look on this post : Qt C++ library in Android Eclipse project: QSQLITE driver not loaded
Not the answer you're looking for? Browse other questions tagged androidqtandroid-studioqsqldatabase or ask your own question.
I am getting error when I try to use SQLite with Qt using below code base on Windows:
I have added library path to QTDirplugins also. When I try to print all available drivers it gives me nothing. I have also copied below out put of my Console application. Note that I am not using any GUI application but using Console Application.
Qsqldatabase Qmysql Driver Not Loaded
Error Message
Qt Sqlite Driver Not Loaded Windows 7
Hello()
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:
Qt Sqlite Example
Database Added
Database is set
I am using visual studio with Qt. I tried lot of option of project configuration but I did not have success. Let me know if any more detail is required
PremalPremal