[solved] how to add .so library to android apk
-
Hello,
I am new to Qt and struggling to be able to add postgresql library file to the android project. I am using Qt on 64 bit windows system and developing for android.
I tried to add libpq.so by adding this line to .pro file@LIBS += -L "e:\sqlib" -libpq.so@
The app is built but when i open apk file with winRar, no libpq.so is found in the lib folder. I also added this code to my cpp file:
@QLibrary library("libpq.so");
if (!library.load())
QMessageBox::warning(this,"Error",library.errorString());@this code returns "no driver found message".
Previously I tried without adding any extra library but it wasn't working. This is actually what I'm trying to accomplish:
@QSqlDatabase db= QSqlDatabase::addDatabase("QPSQL");
db.setHostName("89.129.198.19"); db.setDatabaseName("abcde"); db.setUserName("activa"); db.setPassword("X123xyz"); db.setPort(5432); bool ok = db.open(); if(!ok) { QMessageBox::information(this,"Connection","Connection Failed!"); } else { . . . .}
@
can anyone please help me?EDIT: I forgot to mention that I did a lot of google search before posting question but at last decided to ask.
-
[solution]
[quote author="antreimer" date="1424556611"]I now statically linked the plugin so nothing should be needed to do other then to copy it into the sqldrivers plugin folder https://drive.google.com/open?id=0ByPpOAN5EsHKfmgwRTFvQUl5Z1NvUnlYMHptTEs0d2xEc24xZ19Jb0ZDMTBpb3JDQ014ZkU&authuser=0[/quote]
As prescribed by antreimer I downloaded the file from quoted link and copied libqsqlpsql.so to path/to/Qt/android_armv7/plugins/sqldrivers. Nothing else is required. The library is automatically added and no modification to the .pro file is required