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

Jason H jhihn at gmx.com
Tue Aug 22 15:44:31 CEST 2017


Look ant the Qt/Android stuff. It's pretty much the same except you don't have the android API, but the JNI stuff works. Though the classes start wth QAndroid* and it comes from android_extras, I don't know why it wouldn't work. 

Someone should probably rename those non-android-specific parts to just QJni* and java_extras...


> Sent: Monday, August 21, 2017 at 6:08 AM
> From: "Mariella Squillante" <m.squillante at greenbit.com>
> To: android-development at qt-project.org
> Subject: [Android-development] Use QtGui from Java app via JNI: is it possible?
>
> 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
> 
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development
> 



More information about the Android-development mailing list