Plugin verification data mismatch error on my plugin load
-
Hi,
AFAIK, build and use the plugin with the same version of Qt as well as ensure that you have matching debug/release build.
What version of Qt/OS/Compiler are you using ?
-
sorry SGaist
this error occurs when it tries to load .a file but when it tries to load .dll
void MainFrame::loadPlugin() fileName "serverplugind.dll"
void MainFrame::loadPlugin() pluginLoaded false
void MainFrame::loadPlugin() pluginLoaded "Unknown error"im getting unknown error :(
Im using Qt 5.3, for both win and android
-
Do you mean you are trying to load a static plugin ?
-
Sorry to confuse you.
I am building my project in Release mode. I have already build my plugin code in release mode and my plugin lib name is serverplugin.dll.
While running I try to load serverplugin.dll,
@QDir pluginsDir(qApp->applicationDirPath());
qDebug() << Q_FUNC_INFO << "pluginsDir.dirName"<< pluginsDir.dirName();
#if defined(Q_OS_WIN)
if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release") {
pluginsDir.cdUp();
pluginsDir.cdUp();
pluginsDir.cd("plugins");
}
#endif
foreach (QString fileName, pluginsDir.entryList(QDir::Files))
{
qDebug() << Q_FUNC_INFO << "fileName" << fileName;
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
bool pluginLoaded = pluginLoader.isLoaded();
qDebug() << Q_FUNC_INFO << "pluginLoaded" << pluginLoaded;
qDebug() << Q_FUNC_INFO << "pluginLoaded" <<
pluginLoader.errorString();
QObject *plugin = pluginLoader.instance();
if (plugin)
{
qDebug()<<Q_FUNC_INFO<<"plugin instance is loaded";
m_pServerInterface = qobject_cast<ServerInterface *>(plugin);
if (NULL != m_pServerInterface)
{
qDebug() << Q_FUNC_INFO << "plugin loaded successfully";
}
else
{
//error screen should be displayed.
qDebug() << Q_FUNC_INFO <<
"plugin object casted to "
"ServerInterface is Null";
}
}
}@I get :
void MainFrame::loadPlugin() fileName "serverplugin.dll"
void MainFrame::loadPlugin() pluginLoaded false
void MainFrame::loadPlugin() pluginLoaded "Unknown error"
void MainFrame::loadPlugin() plugin instance is loaded
void MainFrame::loadPlugin() plugin loaded successfullyie, My plugin is not loaded successfully but still instance is returned. This happens in windows. But when I build for android it totally fails to get any instance of the plugin
-
Does your plugin have any dependencies ?
-
yes, it has
QT += widgets
QT += network
QT += sqlBut when I run from the Qt Creator it should be fine right? My plugin .pro file is
@TEMPLATE = lib
CONFIG += plugin
QT += widgets
QT += network
QT += sql
INCLUDEPATH += ../..
HEADERS = serverplugin.h
server.h
serverdbmanager.h
serverfunctionthread.h
commondefenitions.h
SOURCES = serverplugin.cpp
server.cpp
serverdbmanager.cpp
serverfunctionthread.cpp
TARGET = $$qtLibraryTarget(serverplugin)
DESTDIR = ../pluginsOTHER_FILES +=
serverplugin.json
@ -
Did you check that you have all the needed Qt libraries deployed on your target ?
-
If I understood you correctly, it only fails on android, right ?
-
No, when the below lines are executed the cases in windows and android ill explain
@bool pluginLoaded = pluginLoader.isLoaded();
QObject *plugin = pluginLoader.instance();
if (plugin)
{
m_pServerInterface = qobject_cast<ServerInterface *>(plugin);
if (NULL != m_pServerInterface)
{
qDebug() << Q_FUNC_INFO << "plugin loaded successfully";
}
else
{
qDebug() << Q_FUNC_INFO <<
"plugin object casted to "
"ServerInterface is Null";
}
}@win:
pluginLoaded is false
*QObject plugin is not null and @qDebug() << Q_FUNC_INFO << "plugin loaded successfully";@ is executed
so able to call plugin functionsAndroid:
pluginLoaded is false
*QObject plugin is null
so not able to call plugin functions -
Can you post the plugin header file ?
-
@#ifndef SERVERPLUGIN_H
#define SERVERPLUGIN_H#include <QObject>
#include <QtPlugin>
#include "acepos/aceclient/serverinterface.h"#include <QThread>
#include "server.h"class ServerPlugin : public QObject,
public ServerInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.AcePos.ServerInterface/1.0" FILE "serverplugin.json")
Q_INTERFACES(ServerInterface)
QThread *m_pServerThread;
Server *m_pServer;
callbackFunction m_callbackFunction;public:
ServerPlugin():m_pServerThread(NULL), m_pServer(NULL){}private slots:
void handleServiceStartNotify();public:
bool startServerService(callbackFunction);
bool stopServerService();
};#endif
@