Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Accelbubble sample app for sensors on android



  • I am using Qt5.3.0 with android_armv7 target. I can build and deploy the App to my Nexus 7.
    However it launches with a white screen.
    Here is the logcat...
    @
    12-04 20:24:35.482: I/Qt(7890): Sensors start
    12-04 20:24:35.620: W/Qt(7890): gestures\qsensorgesturemanagerprivate.cpp:102 (void QSensorGestureManagerPrivate::initPlugin(QObject*)): Could not load QAndroidPlatformIntegrationPlugin(0xa350a070)
    12-04 20:24:35.620: W/Qt(7890): gestures\qsensorgesturemanagerprivate.cpp:102 (void QSensorGestureManagerPrivate::initPlugin(QObject*)): Could not load AndroidSensorPlugin(0xa35b2160)
    12-04 21:04:09.485: I/Qt(9543): Sensors start
    12-04 21:04:09.500: I/Qt JAVA(9543): DEBUGGER: extra parameters: Bundle[{debug_ping=true, gdbserver_socket=/data/data/org.qtproject.example.accelbubble/debug-socket, qml_debug=true, gdbserver_command=/data/data/org.qtproject.example.accelbubble/lib/gdbserver --multi +/data/data/org.qtproject.example.accelbubble/debug-socket, load_local_jars=jar/QtAndroid-bundled.jar:jar/QtAndroidAccessibility-bundled.jar:jar/QtSensors-bundled.jar:, load_local_libs=plugins/platforms/android/libqtforandroid.so:lib/libQt5QuickParticles.so:plugins/sensors/libqtsensors_android.so:lib/libQt5Xml.so:, use_local_qt_libs=true, libs_prefix=/data/local/tmp/qt/, ping_file=/data/data/org.qtproject.example.accelbubble/debug-ping, static_init_classes=org.qtproject.qt5.android.sensors.QtSensors:, qmljsdebugger=port:54243,block, pong_file=/data/local/tmp/qt/debug-pong-org.qtproject.example.accelbubble}]
    12-04 21:04:46.289: I/Qt(9637): Sensors start
    12-04 21:04:46.395: W/Qt(9637): qrc:///accelbubble.qml:44 module "QtSensors" is not installed
    12-04 21:04:46.395: W/Qt(9637): qrc:///accelbubble.qml:44 module "QtSensors" is not installed
    12-04 21:04:46.395: W/Qt(9637): qrc:///accelbubble.qml:44 module "QtSensors" is not installed
    12-04 21:06:05.605: I/Qt(9971): Sensors start
    @

    So it seems as though there gesture plugins not loading and more basically, QtSensors not installed.

    I tried modding the QML to import latest, but it made no difference
    @
    import QtQuick 2.2
    import QtQuick.Controls 1.1

    import QtSensors 5.0 as Sensors
    import QtQuick.Window 2.0

    ApplicationWindow {
    title: qsTr("Accelerate Bubble")
    id: mainWindow
    width: 640
    height: 480
    visible: true

    Image {
        id: bubble
        source: "Bluebubble.svg"
        smooth: true
        property real centerX: mainWindow.width / 2
        property real centerY: mainWindow.height / 2
        property real bubbleCenter: bubble.width / 2
        x: centerX - bubbleCenter
        y: centerY - bubbleCenter
    
        Behavior on y {
            SmoothedAnimation {
                easing.type: Easing.Linear
                duration: 100
                }
            }
        Behavior on x {
            SmoothedAnimation {
                easing.type: Easing.Linear
                duration: 100
                }
            }
    }
    Sensors.Accelerometer {
        id: accel
        dataRate: 100
        active:true
    
        onReadingChanged: {
            var newX = (bubble.x + calcRoll(accel.reading.x, accel.reading.y, accel.reading.z) * 0.1)
            var newY = (bubble.y - calcPitch(accel.reading.x, accel.reading.y, accel.reading.z) * 0.1)
    
            if (isNaN(newX) || isNaN(newY))
                return;
    
            if (newX < 0)
                newX = 0
    
            if (newX > mainWindow.width - bubble.width)
                newX = mainWindow.width - bubble.width
    
            if (newY < 18)
                newY = 18
    
            if (newY > mainWindow.height - bubble.height)
                newY = mainWindow.height - bubble.height
    
                bubble.x = newX
                bubble.y = newY
        }
    }
    
    function calcPitch(x, y, z) {
        return -(Math.atan(y / Math.sqrt(x * x + z * z)) * 57.2957795);
    }
    function calcRoll(x, y, z) {
        return -(Math.atan(x / Math.sqrt(y * y + z * z)) * 57.2957795);
    }
    
    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }
    

    }
    @
    Can someone tell me how to get this missing stuff built and deployed?

    Thanks!


Log in to reply