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

mapbox implementation



  • Hi,
    I'm trying to load a mapbox into the application (I'm not the first programmer to take care of the application). I tried to do exactly what was described https://docs.mapbox.com/help/tutorials/first-steps-android-sdk/ and each time the application crashed and did not want to build.
    Please help.



  • @kodegiki

    And what is the connection to Qt?



  • @koahnig Every time I tried to type in map instead of osm (mapbox). Reading the documentation from the official website did not help.


  • Moderators

    @kodegiki
    something is still not clear here.
    are you trying to display a map with QtLocation module (which has its own mapbox plugin) or to manually integrate the mapbox SDK via Android API? / Java?!



  • So at first I tried to display using the integrated QtLocation module. I tried to watch movies and did exactly what they contained. Nothing worked. I did it like that

    import QtQuick 2.0
    import QtQuick.Window 2.0
    import QtLocation 5.9
    import QtPositioning 5.8
    
    Window {
    width: 512
    height: 512
    visible: true
    
        Map {
            plugin: Plugin { name: "mapboxgl" }
    
            center: QtPositioning.coordinate(60.170448, 24.942046) // Helsinki
            zoomLevel: 12
    
            MapParameter {
                type: "source"
    
                property var name: "routeSource"
                property var sourceType: "geojson"
                property var data: '{ "type": "FeatureCollection", "features": \
                    [{ "type": "Feature", "properties": {}, "geometry": { \
                    "type": "LineString", "coordinates": [[ 24.934938848018646, \
                    60.16830257086771 ], [ 24.943315386772156, 60.16227776476442 ]]}}]}'
            }
    
            MapParameter {
                type: "layer"
    
                property var name: "route"
                property var layerType: "line"
                property var source: "routeSource"
    
                // Draw under the first road label layer
                // of the mapbox-streets style.
                property var before: "road-label-small"
            }
    
            MapParameter {
                type: "paint"
    
                property var layer: "route"
                property var lineColor: "blue"
                property var lineWidth: 8.0
            }
    
            MapParameter {
                type: "layout"
    
                property var layer: "route"
                property var lineJoin: "round"
                property var lineCap: "round"
            }
        }
    }
    
    

    it ended with this mistake
    W QtThread: type=1400 audit(0.0:86): avc: granted { execute } for path="/data/data/org.qtproject.example.nienazwany/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so" dev="vdc" ino=22569 scontext=u:r:untrusted_app_27:s0:c134,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c134,c256,c512,c768 tclass=file app=org.qtproject.example.nienazwany
    W linker : Warning: "/data/data/org.qtproject.example.nienazwany/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
    W QtThread: type=1400 audit(0.0:87): avc: granted { execute } for path="/data/data/org.qtproject.example.nienazwany/qt-reserved-files/qml/QtQuick/Window.2/libwindowplugin.so" dev="vdc" ino=22574 scontext=u:r:untrusted_app_27:s0:c134,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c134,c256,c512,c768 tclass=file app=org.qtproject.example.nienazwany
    W linker : Warning: "/data/data/org.qtproject.example.nienazwany/qt-reserved-files/qml/QtQuick/Window.2/libwindowplugin.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
    W linker : Warning: "/data/data/org.qtproject.example.nienazwany/qt-reserved-files/qml/QtLocation/libdeclarative_location.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
    W linker : Warning: "/data/data/org.qtproject.example.nienazwany/qt-reserved-files/qml/QtPositioning/libdeclarative_positioning.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
    W QtThread: type=1400 audit(0.0:88): avc: granted { execute } for path="/data/data/org.qtproject.example.nienazwany/qt-reserved-files/qml/QtLocation/libdeclarative_location.so" dev="vdc" ino=22577 scontext=u:r:untrusted_app_27:s0:c134,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c134,c256,c512,c768 tclass=file app=org.qtproject.example.nienazwany


  • Moderators

    @kodegiki
    those are not errors but only warnings and do not affect your app in the end.

    You should also start reading the docs at very first - like for every problem you encounter actually.
    You need to provide an API key in order to use MapBox service (like for most 3rd party services).
    So first register your application on the MapBox website and paste the provided key to the plugin as stated in the docs.



  • I have read the documentation before and gave the api key to the PluginParameter. Now app is on but i only see white background


Log in to reply