[Android-development] Call a library using QtWidgets from Java app: it is possible?

Mariella Squillante sqrella at gmail.com
Thu Aug 10 15:29:15 CEST 2017


Hi Qt for Android developers,

I have posted this question
<https://forum.qt.io/topic/82030/qapplication-crashes-on-constructor-from-jni-android>
(
https://forum.qt.io/topic/82030/qapplication-crashes-on-constructor-from-jni-android)
to the Qt forum, about a library using QtWidgets called from Java app, and
they redirected me here.
I'm wondering if it's possible to have my configuration working on Android
as it works in other platforms.
Since that post, I've investigated more, I've discovered that, when loaded
dinamically via JNI from the Java app, the function JNI_OnLoad inside my
library is not called, maybe this can be a problem?
So I've made another test: I've created a non-Qt console application with
QtCreator, linked to my library, and deployed to Android, and it seems to
put inside the apk all the necessary pieces.
Called in this way, JNI_OnLoad is called, I can create QApplication, I can
create a QDialog, but it hangs the first time I call
QApplication::ProcessMessages.
I've read also this post
<http://lists.qt-project.org/pipermail/android-development/2017-June/000958.html>
(
http://lists.qt-project.org/pipermail/android-development/2017-June/000958.html),
but it seems too complex to me, and I would like to know if it is possible
to do what I need, before trying to go into this solution.

Thanks in advance,

Mariella
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20170810/2c8339d8/attachment.html>


More information about the Android-development mailing list