[Android-development] Use QtGui from Java app via JNI: is it possible?

Mariella Squillante m.squillante at greenbit.com
Mon Aug 21 12:08:50 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) 
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::processEvents.
I've read also this post 
(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




More information about the Android-development mailing list