Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issue with displaying maps on Qt Android Application
Forum Updated to NodeBB v4.3 + New Features

Issue with displaying maps on Qt Android Application

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 531 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aninoss
    wrote on 10 May 2023, 16:27 last edited by Aninoss 5 Oct 2023, 16:32
    #1

    Hello Everyone
    For the past three days, I have been working on integrating Google Maps, OSM, and Here maps into an Android application, but unfortunately, I have been facing some difficulties. Interestingly, all the maps I mentioned work perfectly on Windows, Linux, Mac, and iOS.

    I have tried several Android emulators and real devices, including Samsung, Huawei, Xiaomi, and OnePlus, but with no success. I have even tried it on several other machines, but it seems like the problem is with the Qt Android framework itself.

    Cmake code

    cmake_minimum_required(VERSION 3.21)
    project(QGuiApp VERSION 1.0.0 LANGUAGES CXX)
    
    set(CMAKE_AUTOMOC ON)
    set(CXX_STANDARD 17)
    set(CXX_STANDARD_REQUIRED ON)
    
    # ========= Set directories
    set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/src")
    set(INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")
    
    # ========= Include directories
    include_directories(${SOURCE_DIR})
    include_directories(${INCLUDE_DIR})
    
    # ========= Add directories files
    file(GLOB_RECURSE SOURCES
        "${SOURCE_DIR}/*.cpp"
        "${INCLUDE_DIR}/*.h"
    )
    
    # ========= Include libraries
    find_package(Qt6 COMPONENTS Gui Quick Positioning Location REQUIRED)
    
    # ========= Add executable
    qt_add_executable(${CMAKE_PROJECT_NAME}
        ${SOURCES}
    )
    
    # ========= Set Resources
    set(RESOURCE_DIR
        "resource/imgs/Profile.jpg"
    )
    
    # ========= Add qml medule
    qt_add_qml_module(${CMAKE_PROJECT_NAME}
        URI mainLib
        VERSION 1.0
        QML_FILES
        interfaces/main.qml
        components/myButton.qml
        RESOURCES
        ${RESOURCE_DIR}
    )
    
    # ========= Cnfigure Android package
    if(ANDROID)
        set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
        set_property(TARGET QGuiApp PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR ${ANDROID_PACKAGE_SOURCE_DIR})
        add_custom_target(cmake_android_package
            SOURCES
            ${ANDROID_PACKAGE_SOURCE_DIR}/AndroidManifest.xml
            ${ANDROID_PACKAGE_SOURCE_DIR}/build.gradle
            ${ANDROID_PACKAGE_SOURCE_DIR}/grable.properties
            ${ANDROID_PACKAGE_SOURCE_DIR}/res/values/libs.xml
        )
    
        if(ANDROID_ABI STREQUAL "armeabi-v7a")
            set(ANDROID_EXTRA_LIBS
                ${CMAKE_CURRENT_SOURCE_DIR}/lib/armeabi-v7a/libcrypto_1_1.so
                ${CMAKE_CURRENT_SOURCE_DIR}/lib/armeabi-v7a/libssl_1_1.so)
        endif()
    
        if(ANDROID_ABI STREQUAL "x86_64")
            set(ANDROID_EXTRA_LIBS
                ${CMAKE_CURRENT_SOURCE_DIR}/lib/x86_64/libcrypto_1_1.so
                ${CMAKE_CURRENT_SOURCE_DIR}/lib/x86_64/libssl_1_1.so)
        endif()
    endif()
    
    # ========= Link target subDirectories
    target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC src)
    target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC include)
    
    # ========= Link libraries
    target_link_libraries(${CMAKE_PROJECT_NAME}
        PRIVATE Qt6::Gui
        Qt6::Quick
        Qt6::Positioning
        Qt6::Location
    )
    

    Cpp

    
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication application(argc, argv);
        QQmlApplicationEngine engine;
    
        const QUrl url(u"qrc:/mainLib/interfaces/main.qml"_qs);
        QObject::connect(
            &engine, &QQmlApplicationEngine::objectCreated, &application, [url](QObject *obj, const QUrl &objUrl)
            {
            if(!obj && objUrl == url)
                QGuiApplication::exit(-1); },
            Qt::QueuedConnection);
        engine.load(url);
    
        qDebug() << "Applicaiton name: " << QGuiApplication::applicationName();
        application.setApplicationVersion("1.0.0");
        qDebug() << "Applicaiton version: " << QGuiApplication::applicationVersion();
        qDebug() << "Platform name: " << QGuiApplication::platformName();
        qDebug() << "Platform name: " << application.platformName();
        qDebug() << "Device pixel ratio: " << application.devicePixelRatio();
    
        return application.exec();
    }
    

    Qml

    import QtQuick 6.5
    import QtQuick.Controls 6.5
    import QtPositioning 6.5
    import QtLocation 6.5
    
    Window {
        color: "red"
        height: 500
        title: qsTr("Hello World!")
        visible: true
        width: 700
    
        Rectangle {
            anchors.fill: parent
            anchors.margins: 10
            color: "#ffffff"
    
            Plugin {
                id: mapPlugin
                name: "osm"
            }
    
            // Plugin {
            //     id: mapPlugin
            //     name: "googlemaps"
            //     PluginParameter {
            //         name: "apikey"
            //         value: "ApiKey"
            //     }
            // }
    
            Map {
                id: map
                anchors.fill: parent
                plugin: mapPlugin
                center: QtPositioning.coordinate(59.91, 10.75) // Oslo
                zoomLevel: 14
            }
        }
    }
    

    AndroidManifest.xml

    <?xml version="1.0"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.qtproject.example" android:installLocation="auto" android:versionCode="3" android:versionName="1.2">
        <!-- %%INSERT_PERMISSIONS -->
        <!-- %%INSERT_FEATURES -->
        <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
        <application android:name="org.qtproject.qt.android.bindings.QtApplication" android:hardwareAccelerated="true" android:label="-- %%INSERT_APP_NAME%% --" android:requestLegacyExternalStorage="true" android:allowNativeHeapPointerTagging="false" android:allowBackup="true" android:fullBackupOnly="false" android:icon="@drawable/icon">
            <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="ApiKey">
            </meta-data>
            <activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
                <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
                <meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
                <meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
            </activity>
        </application>
    </manifest>
    

    and I also add implementation 'com.google.android.gms:play-services-maps:18.1.0'
    to build.gradle and android.useAndroidX=true to gradle.properties
    The Qt Creator Output

    I project.exampl: Late-enabling -Xcheck:jni
    W project.exampl: Unexpected CPU variant for X86 using defaults: x86_64
    D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10164; state: DISABLED
    V GraphicsEnvironment: ANGLE Developer option for 'org.qtproject.example' set to: 'default'
    V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.
    D NetworkSecurityConfig: No Network Security Config specified, using platform default
    D NetworkSecurityConfig: No Network Security Config specified, using platform default
    D libEGL  : loaded /vendor/lib64/egl/libEGL_emulation.so
    D libEGL  : loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
    D libEGL  : loaded /vendor/lib64/egl/libGLESv2_emulation.so
    W System  : ClassLoader referenced unknown path:
    D Qt JAVA : Class org.qtproject.qt.android.positioning.QtPositioning does not implement setActivity method
    I QtCore  : Start
    I qt.positioning.android: Positioning start
    I Qt      : qt started
    D HostConnection: createUnique: call
    D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b0f3910, tid 25313
    D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
    W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    W OpenGLRenderer: Failed to initialize 101010-2 format, error = EGL_SUCCESS
    D EGL_emulation: eglCreateContext: 0x7bea4b0f2350: maj 3 min 1 rcv 4
    D EGL_emulation: eglMakeCurrent: 0x7bea4b0f2350: ver 3 1 (tinfo 0x7bec6ba00080) (first time)
    I Gralloc4: mapper 4.x is not supported
    D HostConnection: createUnique: call
    D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b0efb90, tid 25313
    D goldfish-address-space: allocate: Ask for block of size 0x100
    D goldfish-address-space: allocate: ioctl allocate returned offset 0x3e3ffe000 size 0x2000
    W Gralloc4: allocator 4.x is not supported
    D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
    D HostConnection: createUnique: call
    D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b104ad0, tid 25316
    D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
    D EGL_emulation: eglCreateContext: 0x7bea4b103d50: maj 3 min 1 rcv 4
    D EGL_emulation: eglMakeCurrent: 0x7bea4b103d50: ver 3 1 (tinfo 0x7bec6ba00100) (first time)
    D HostConnection: createUnique: call
    D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b0f1510, tid 25336
    D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
    D EGL_emulation: eglCreateContext: 0x7bea4b0efad0: maj 3 min 1 rcv 4
    D EGL_emulation: eglMakeCurrent: 0x7bea4b0efad0: ver 3 1 (tinfo 0x7bec6ba00180) (first time)
    D libQGuiApp_x86_64.so: Applicaiton name:  "libQGuiApp_x86_64.so"
    D libQGuiApp_x86_64.so: Applicaiton version:  "1.0.0"
    D libQGuiApp_x86_64.so: Platform name:  "android"
    D libQGuiApp_x86_64.so: Platform name:  "android"
    D libQGuiApp_x86_64.so: Device pixel ratio:  3.5
    W libQGuiApp_x86_64.so: QGeoTileProviderOsm: Tileserver disabled at  QUrl("http://maps-redirect.qt.io/osm/5.8/satellite")
    W libQGuiApp_x86_64.so: QGeoTileFetcherOsm: all providers resolved
    W qt.tlsbackend.ossl: : Failed to load libssl/libcrypto.
    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
    W qt.network.ssl: : Active TLS backend does not support key creation
    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
    W qt.network.ssl: : Active TLS backend does not support key creation
    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
    W qt.network.ssl: : Active TLS backend does not support key creation
    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
    W qt.network.ssl: : Active TLS backend does not support key creation
    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
    W qt.network.ssl: : Active TLS backend does not support key creation
    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
    W qt.network.ssl: : Active TLS backend does not support key creation
    W qt.network.ssl: : The backend "cert-only" does not support QSslSocket
    W qt.network.ssl: : The backend named "cert-only" does not support TLS
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    D EGL_emulation: app_time_stats: avg=361.53ms min=1.25ms max=2465.30ms count=7
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
    

    I have successfully built the Google Maps plugin, which is functioning well on all other platforms.
    If anyone has encountered a similar issue, I would appreciate any help or guidance on this matter.

    JoeCFDJ 1 Reply Last reply 10 May 2023, 18:25
    0
    • A Aninoss
      10 May 2023, 16:27

      Hello Everyone
      For the past three days, I have been working on integrating Google Maps, OSM, and Here maps into an Android application, but unfortunately, I have been facing some difficulties. Interestingly, all the maps I mentioned work perfectly on Windows, Linux, Mac, and iOS.

      I have tried several Android emulators and real devices, including Samsung, Huawei, Xiaomi, and OnePlus, but with no success. I have even tried it on several other machines, but it seems like the problem is with the Qt Android framework itself.

      Cmake code

      cmake_minimum_required(VERSION 3.21)
      project(QGuiApp VERSION 1.0.0 LANGUAGES CXX)
      
      set(CMAKE_AUTOMOC ON)
      set(CXX_STANDARD 17)
      set(CXX_STANDARD_REQUIRED ON)
      
      # ========= Set directories
      set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/src")
      set(INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")
      
      # ========= Include directories
      include_directories(${SOURCE_DIR})
      include_directories(${INCLUDE_DIR})
      
      # ========= Add directories files
      file(GLOB_RECURSE SOURCES
          "${SOURCE_DIR}/*.cpp"
          "${INCLUDE_DIR}/*.h"
      )
      
      # ========= Include libraries
      find_package(Qt6 COMPONENTS Gui Quick Positioning Location REQUIRED)
      
      # ========= Add executable
      qt_add_executable(${CMAKE_PROJECT_NAME}
          ${SOURCES}
      )
      
      # ========= Set Resources
      set(RESOURCE_DIR
          "resource/imgs/Profile.jpg"
      )
      
      # ========= Add qml medule
      qt_add_qml_module(${CMAKE_PROJECT_NAME}
          URI mainLib
          VERSION 1.0
          QML_FILES
          interfaces/main.qml
          components/myButton.qml
          RESOURCES
          ${RESOURCE_DIR}
      )
      
      # ========= Cnfigure Android package
      if(ANDROID)
          set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
          set_property(TARGET QGuiApp PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR ${ANDROID_PACKAGE_SOURCE_DIR})
          add_custom_target(cmake_android_package
              SOURCES
              ${ANDROID_PACKAGE_SOURCE_DIR}/AndroidManifest.xml
              ${ANDROID_PACKAGE_SOURCE_DIR}/build.gradle
              ${ANDROID_PACKAGE_SOURCE_DIR}/grable.properties
              ${ANDROID_PACKAGE_SOURCE_DIR}/res/values/libs.xml
          )
      
          if(ANDROID_ABI STREQUAL "armeabi-v7a")
              set(ANDROID_EXTRA_LIBS
                  ${CMAKE_CURRENT_SOURCE_DIR}/lib/armeabi-v7a/libcrypto_1_1.so
                  ${CMAKE_CURRENT_SOURCE_DIR}/lib/armeabi-v7a/libssl_1_1.so)
          endif()
      
          if(ANDROID_ABI STREQUAL "x86_64")
              set(ANDROID_EXTRA_LIBS
                  ${CMAKE_CURRENT_SOURCE_DIR}/lib/x86_64/libcrypto_1_1.so
                  ${CMAKE_CURRENT_SOURCE_DIR}/lib/x86_64/libssl_1_1.so)
          endif()
      endif()
      
      # ========= Link target subDirectories
      target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC src)
      target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC include)
      
      # ========= Link libraries
      target_link_libraries(${CMAKE_PROJECT_NAME}
          PRIVATE Qt6::Gui
          Qt6::Quick
          Qt6::Positioning
          Qt6::Location
      )
      

      Cpp

      
      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication application(argc, argv);
          QQmlApplicationEngine engine;
      
          const QUrl url(u"qrc:/mainLib/interfaces/main.qml"_qs);
          QObject::connect(
              &engine, &QQmlApplicationEngine::objectCreated, &application, [url](QObject *obj, const QUrl &objUrl)
              {
              if(!obj && objUrl == url)
                  QGuiApplication::exit(-1); },
              Qt::QueuedConnection);
          engine.load(url);
      
          qDebug() << "Applicaiton name: " << QGuiApplication::applicationName();
          application.setApplicationVersion("1.0.0");
          qDebug() << "Applicaiton version: " << QGuiApplication::applicationVersion();
          qDebug() << "Platform name: " << QGuiApplication::platformName();
          qDebug() << "Platform name: " << application.platformName();
          qDebug() << "Device pixel ratio: " << application.devicePixelRatio();
      
          return application.exec();
      }
      

      Qml

      import QtQuick 6.5
      import QtQuick.Controls 6.5
      import QtPositioning 6.5
      import QtLocation 6.5
      
      Window {
          color: "red"
          height: 500
          title: qsTr("Hello World!")
          visible: true
          width: 700
      
          Rectangle {
              anchors.fill: parent
              anchors.margins: 10
              color: "#ffffff"
      
              Plugin {
                  id: mapPlugin
                  name: "osm"
              }
      
              // Plugin {
              //     id: mapPlugin
              //     name: "googlemaps"
              //     PluginParameter {
              //         name: "apikey"
              //         value: "ApiKey"
              //     }
              // }
      
              Map {
                  id: map
                  anchors.fill: parent
                  plugin: mapPlugin
                  center: QtPositioning.coordinate(59.91, 10.75) // Oslo
                  zoomLevel: 14
              }
          }
      }
      

      AndroidManifest.xml

      <?xml version="1.0"?>
      <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.qtproject.example" android:installLocation="auto" android:versionCode="3" android:versionName="1.2">
          <!-- %%INSERT_PERMISSIONS -->
          <!-- %%INSERT_FEATURES -->
          <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
          <application android:name="org.qtproject.qt.android.bindings.QtApplication" android:hardwareAccelerated="true" android:label="-- %%INSERT_APP_NAME%% --" android:requestLegacyExternalStorage="true" android:allowNativeHeapPointerTagging="false" android:allowBackup="true" android:fullBackupOnly="false" android:icon="@drawable/icon">
              <meta-data
                  android:name="com.google.android.geo.API_KEY"
                  android:value="ApiKey">
              </meta-data>
              <activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
                  <intent-filter>
                      <action android:name="android.intent.action.MAIN"/>
                      <category android:name="android.intent.category.LAUNCHER"/>
                  </intent-filter>
                  <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
                  <meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
                  <meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
              </activity>
          </application>
      </manifest>
      

      and I also add implementation 'com.google.android.gms:play-services-maps:18.1.0'
      to build.gradle and android.useAndroidX=true to gradle.properties
      The Qt Creator Output

      I project.exampl: Late-enabling -Xcheck:jni
      W project.exampl: Unexpected CPU variant for X86 using defaults: x86_64
      D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10164; state: DISABLED
      V GraphicsEnvironment: ANGLE Developer option for 'org.qtproject.example' set to: 'default'
      V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.
      D NetworkSecurityConfig: No Network Security Config specified, using platform default
      D NetworkSecurityConfig: No Network Security Config specified, using platform default
      D libEGL  : loaded /vendor/lib64/egl/libEGL_emulation.so
      D libEGL  : loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
      D libEGL  : loaded /vendor/lib64/egl/libGLESv2_emulation.so
      W System  : ClassLoader referenced unknown path:
      D Qt JAVA : Class org.qtproject.qt.android.positioning.QtPositioning does not implement setActivity method
      I QtCore  : Start
      I qt.positioning.android: Positioning start
      I Qt      : qt started
      D HostConnection: createUnique: call
      D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b0f3910, tid 25313
      D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
      W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
      W OpenGLRenderer: Failed to initialize 101010-2 format, error = EGL_SUCCESS
      D EGL_emulation: eglCreateContext: 0x7bea4b0f2350: maj 3 min 1 rcv 4
      D EGL_emulation: eglMakeCurrent: 0x7bea4b0f2350: ver 3 1 (tinfo 0x7bec6ba00080) (first time)
      I Gralloc4: mapper 4.x is not supported
      D HostConnection: createUnique: call
      D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b0efb90, tid 25313
      D goldfish-address-space: allocate: Ask for block of size 0x100
      D goldfish-address-space: allocate: ioctl allocate returned offset 0x3e3ffe000 size 0x2000
      W Gralloc4: allocator 4.x is not supported
      D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
      D HostConnection: createUnique: call
      D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b104ad0, tid 25316
      D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
      D EGL_emulation: eglCreateContext: 0x7bea4b103d50: maj 3 min 1 rcv 4
      D EGL_emulation: eglMakeCurrent: 0x7bea4b103d50: ver 3 1 (tinfo 0x7bec6ba00100) (first time)
      D HostConnection: createUnique: call
      D HostConnection: HostConnection::get() New Host Connection established 0x7bea4b0f1510, tid 25336
      D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
      D EGL_emulation: eglCreateContext: 0x7bea4b0efad0: maj 3 min 1 rcv 4
      D EGL_emulation: eglMakeCurrent: 0x7bea4b0efad0: ver 3 1 (tinfo 0x7bec6ba00180) (first time)
      D libQGuiApp_x86_64.so: Applicaiton name:  "libQGuiApp_x86_64.so"
      D libQGuiApp_x86_64.so: Applicaiton version:  "1.0.0"
      D libQGuiApp_x86_64.so: Platform name:  "android"
      D libQGuiApp_x86_64.so: Platform name:  "android"
      D libQGuiApp_x86_64.so: Device pixel ratio:  3.5
      W libQGuiApp_x86_64.so: QGeoTileProviderOsm: Tileserver disabled at  QUrl("http://maps-redirect.qt.io/osm/5.8/satellite")
      W libQGuiApp_x86_64.so: QGeoTileFetcherOsm: all providers resolved
      W qt.tlsbackend.ossl: : Failed to load libssl/libcrypto.
      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
      W qt.network.ssl: : Active TLS backend does not support key creation
      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
      W qt.network.ssl: : Active TLS backend does not support key creation
      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
      W qt.network.ssl: : Active TLS backend does not support key creation
      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
      W qt.network.ssl: : Active TLS backend does not support key creation
      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
      W qt.network.ssl: : Active TLS backend does not support key creation
      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
      W qt.network.ssl: : Active TLS backend does not support key creation
      W qt.network.ssl: : The backend "cert-only" does not support QSslSocket
      W qt.network.ssl: : The backend named "cert-only" does not support TLS
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      D EGL_emulation: app_time_stats: avg=361.53ms min=1.25ms max=2465.30ms count=7
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
      

      I have successfully built the Google Maps plugin, which is functioning well on all other platforms.
      If anyone has encountered a similar issue, I would appreciate any help or guidance on this matter.

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on 10 May 2023, 18:25 last edited by
      #2

      @Aninoss do you need network module?

      A 1 Reply Last reply 10 May 2023, 19:10
      0
      • JoeCFDJ JoeCFD
        10 May 2023, 18:25

        @Aninoss do you need network module?

        A Offline
        A Offline
        Aninoss
        wrote on 10 May 2023, 19:10 last edited by
        #3

        @JoeCFD said in Issue with displaying maps on Qt Android Application:

        do you need network module?

        I Did but the same problem still occurs

        JoeCFDJ 1 Reply Last reply 10 May 2023, 19:47
        0
        • A Aninoss
          10 May 2023, 19:10

          @JoeCFD said in Issue with displaying maps on Qt Android Application:

          do you need network module?

          I Did but the same problem still occurs

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on 10 May 2023, 19:47 last edited by
          #4

          @Aninoss from chatGPT

          The error message "qt.network.ssl: : The backend 'cert-only' does not support QSslKey" indicates that the SSL backend being used by the Qt library does not support the use of QSslKey objects.

          QSslKey is a class in the Qt library that represents an SSL private key. The SSL backend is responsible for handling SSL/TLS connections and encrypting and decrypting data.

          The "cert-only" backend is a backend in the Qt library that provides SSL functionality without support for private keys. This backend is often used in situations where only server-side authentication is required, such as in cases where the server only needs to present a valid SSL certificate to clients.

          To resolve this error, you can try using a different SSL backend in the Qt library that supports QSslKey objects. For example, the OpenSSL backend supports QSslKey objects and is widely used. You can switch to the OpenSSL backend by setting the environment variable QT_SSL_BACKEND to "openssl" before running your application.

          Alternatively, you can modify your code to not use QSslKey objects, or use a different SSL library altogether.

          1 Reply Last reply
          0

          1/4

          10 May 2023, 16:27

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved