Library in Qt used in an Android App ( Java )
-
wrote on 13 Nov 2013, 10:52 last edited by
Hi everyone,
I am facing an issue with using qt 5.2 mixed up with a Java App for Android.
Here is the situation :
- Simple application (hello world-like) built in eclipse.
- A library based on Qt built with cmake as a shared library.
When starting the application, it crashes and says that it could not load library "libQt5Network.so" need by "libJNI.so", caused by library 'libQt5Network.so".
For various reason, i would like to still develop the application in java but would like to integrate some features of Qt. I know that when building an application only with Qt, there is that possibility to embed Qt libraries or use ministro. How could I do so, through eclipse ?
-
wrote on 14 Nov 2013, 09:24 last edited by
Hi,
In fact, each Qt application for android consists of two parts:
actually qt code and "Java bindings". More info you could find "here":http://blog.qt.digia.com/blog/2013/07/23/anatomy-of-a-qt-5-for-android-application/. If you want to mix qt application with java code, you could inherit QtActivity class (which is used to launch qt application on Android, load library, invoke Ministro etc.) and write there your java code. -
wrote on 14 Nov 2013, 09:35 last edited by
Also you could try use Qt's Java binding as an example and write your own main Activity, that will load all necessary library, forward event to qt and so on.
-
wrote on 14 Nov 2013, 18:51 last edited by
Thanks for you answer, so does it means that I could have only libraries built in QT ( no UI ) and have the UI only in Java ?
-
wrote on 14 Nov 2013, 21:07 last edited by
Yes, but unfortunately I couldn't tell you how much effort it's needed. It seems to me that it can be not a trivial task and it depends of what Qt module your lib requires. Maybe you need only put and load some additional library like Qt5Network, or maybe your library need to have some launched QEventLoop to work so you need to have some wrapper for your library that launch QApplication. Anyway, source code of QtApplication.java and QtActivity.java could help you.
-
wrote on 15 Nov 2013, 08:18 last edited by
I will look into that, I also looked at Qt Jambi which as wrapper for Qt in Java.
1/6