1

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).

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

suns9
  • 875
  • 2
  • 8
  • 17

2 Answers2

3

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

Aurelien
  • 1,032
  • 2
  • 10
  • 24
  • I compiled the driver using the ndk. I can found it in the lib folder in the apk. So I think the driver is not found by Qt. Do you know how I can say to Qt where to looking for finding the driver (in Android)? – suns9 Jul 29 '16 at 09:02
1

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

Community
  • 1
  • 1
suns9
  • 875
  • 2
  • 8
  • 17