Using Qt creator, I complied MyLib.so, MyLibQt.so (compiled for android). MyLib is wrapper for using MyLibQt. In MyLibQt I have such lines
if (!QApplication::instance())
{
g_bCleanUpInstance = true;
new QApplication(argc, argv);
}
At Android Studio I added these libs to project (jniLibs). The lib has been successfully added to apk, it has been compiled. The problem is: when I try call method from MyLib, using previous lines of code, I get exception:
A/MyLibQt.dll: (null):0 ((null)): This application failed to start because it could not find or load the Qt platform plugin "android"
I added to jniLibs libqtforandroid.so, but it didn't helped. So, my question is: how to resolve it?
Sorry for so late answer. Root cause of the issue was not so obvious. Qt plugin for Android requires function main() in your custom library. If the plugin doesn't find the function, the plugin throws exception and the plugin will not correctly loaded.
It was about Qt5.4- 5.7. I don't know how it is now but can suggest that there is same situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With