Qt World Summit: Register Today!

OpenGL QWindow Example crashes on Android (SOLVED)

  • I'm tying to find out how to work with the QWindow, but it doesn't work on my android device.

    Here is the error message:
    @W/Qt ( 9120): kernel/qplatformintegration.cpp:252 (virtual QPlatformOpenGLContext* QPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext*) const): This plugin does not support createPlatformOpenGLContext!@

  • Solved. I forgot to add Qt5OpenGL in libraries.

  • Can you elaborate on how you solved that? I'm having the same problem and I don't understand what you mean by adding Qt5OpenGL in libraries.

  • The problem was caused by the missing Qt OpenGL Shared library (or shared object *.so). It should be bundled in the apk file. Check your "Run" configuration in "Projects" mode. There are should be check boxes with libraries names. OpenGL should be checked.

  • I went into the "Run" configuration and I don't see any check boxes for libraries. I'm using Qt 5.2 so maybe that has changed but I see a radio button that says "Bundle QT libraries in APK" which is checked. Then there is a list of "Additional Libraries "which I added
    But I'm still getting the error. Perhaps I should open a new thread

  • Interface of QtCreator 3.0 is slightly different and it doesn't contain the check boxes for libraries like it was in QtCreator 2.x. You can use "this manual":http://qt-project.org/doc/qtcreator-3.0/creator-deploying-android.html#packaging-qt-5-applications

    Maybe your problem is not the same as I had.

    I can advise you to make the next steps:
    Check is your Qt version was built with OpenGL support
    Check is your *.pro file contain QT += opengl
    Check is your apk archive contain all necessary libraries (via a default archiver)

  • I previously did not have QT += opengl, but after adding it, there is no effect (error still appears). I opened the .apk file and looked in the library directory and it looks like it contains all of the necessary libraries:

    • libplugins_accessible_libqtaccessiblewidgets.so
    • libplugins_imageformats_libqgif.so
    • libplugins_imageformats_libqico.so
    • libplugins_imageformats_libqjpeg.so
    • libplugins_imageformats_libqmng.so
    • libplugins_imageformats_libqtga.so
    • libplugins_imageformats_libqtiff.so
    • libplugins_imageformats_libqwbmp.so
    • libplugins_platforms_android_libqtforandroid.so
    • libplugins_platforms_android_libqtforandroidGL.so
    • libplugins_platforms_libqminimal.so
    • libplugins_platforms_libqoffscreen.so
    • libQt5Core.so
    • libQt5Gui.so
    • libQt5OpenGL.so
    • libQt5Widgets.so
    • libQtGameLib.so

    As for the last one, how can I check if OpenGL is supported? I'm using the 5.2.0 for Android (Windows 32-bit) installer from the main downloads page, I would assume that build has OpenGL support, but it's possible that it does not include OpenGL support.

  • Looks like you have all the required libraries in your apk.
    It seems that the problem in the code itself.
    Try to run a Qt example with OpenGL for android (OpenGL Window Example will be the best).
    Is it work fine on the device?

  • I opened the OpenGL Window project and ran on Android, and it crashes with the same error. The only thing I can think of is that the Android binaries on the main download page were not built with openGL support for some reason. I suppose I can try compiling the android binaries with openGL support.

  • I used "Qt 5.2.0 for Android (Windows 32-bit)":http://download.qt-project.org/official_releases/qt/5.2/5.2.0/qt-windows-opensource-5.2.0-android-x86-win32-offline.exe and it really has the problem you are talking about.
    I fixed it by adding "QT += opengl" in the openglwindow.pro file and rebuilt it.
    After that it works just fine.

  • Oh! I tried the same thing earlier and it didn't work, but I retried it and it works now. I must have rebuilt it improperly the first time (probably didn't run qmake again).

    Thanks so much for you help working great now

  • You are welcome.

Log in to reply