Qt.WebSocket 1.0 on Android



  • I'm creating a app the comunicate with websocket using QML Controls 2. When i make the aplication to DESKTOP (Ming Compiler) the aplication works perfect but when I change to Android them aplication compiles OK, but when open the page that use websockt show error QtWebSocket doesn found. !

    On QT Design when change to Android the import import Qt.WebSockets 1.0 stays with a red line.

    When compile to android show this warnings:

    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Material.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Universal.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.impl

    When the aplication is runnig:
    W Gallery : (null):0 ((null)): Can't find surface 1
    W Gallery : (null):0 ((null)): QQmlComponent: Component is not ready
    W Gallery : (null):0 ((null)): qrc:/pages/Monitoramento.qml:2 module "Qt.WebSockets" plugin "declarative_qmlwebsockets" not found

    Version: QT 5.7.1 Android Windows com Ming32

    Anyone knows how to use the websocket in android?



  • Without the dot it does work, so QtWebSockets works, Qt.WebSockets does not at least for me it does!

    Regards



  • Hi,

    Yes, as mentioned in the documentation, at the very top of the WebSocket QML Type page (https://doc.qt.io/qt-5/qml-qtwebsockets-websocket.html), the import statement must be as follow :

    import QtWebSockets 1.0
    

    Or

    import QtWebSockets 1.1
    

    for Qt 5.8 and higher.

    You should change the post's status to resolve ;-)

    Daniel


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.