Important: Please read the Qt Code of Conduct -

Library in Qt used in an Android App ( Java )

  • 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 "" need by "", caused by library '".

    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 ?

  • Hi,
    In fact, each Qt application for android consists of two parts:
    actually qt code and "Java bindings". More info you could find "here": 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.

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

  • 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 ?

  • 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 and could help you.

  • I will look into that, I also looked at Qt Jambi which as wrapper for Qt in Java.

Log in to reply