Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How come elements don't appear in Android Emulator but do appear on mobile device?
Forum Updated to NodeBB v4.3 + New Features

How come elements don't appear in Android Emulator but do appear on mobile device?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 757 Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    Background information

    Using
    Windows 11

    Deploying to Android virtual device doesn't make elements appear as they should as we'll see from the photos
    Android_Qt_6_8_0_Clang_x86_64-Debug
    Galaxy Nexus (x86_64 Android 13.0 SDK 33)

    Deploying to an Android mobile device makes elements appear as they should as we'll see from the photos
    Android_Qt_6_8_0_Clang_arm64_v8a-Debug
    moto g(30)

    Get some red messages in application output when deploying to Android virtual device in case it matters

    W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    W OpenGLRenderer: Failed to initialize 101010-2 format, error = EGL_SUCCESS
    
    W Parcel  : Expecting binder but got null!
    
    E emuglGLESv2_enc: device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2183 GL error 0x502
    

    Code for the project
    The page contents I'm trying to make appear. PageSettings.qml
    https://github.com/ProjectsKoryHasWorkedOn/DanceSyllabusesApp_2024/blob/main/import/qml/PageSettings.qml

    The Main.QML file with the StackView at the bottom. Can call PageSettings.qml from this
    https://github.com/ProjectsKoryHasWorkedOn/DanceSyllabusesApp_2024/blob/main/import/qml/Main.qml


    Problem description

    Followed the steps found here
    https://spaceofna-com.translate.goog/android-studio-avd-gl-error-0x502/?_x_tr_sl=ko&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=sc

    Discovered that I can make the elements on PageSettings.qml appear if I set
    Emulated performance > Graphics: Software

    Although it looks awful
    https://ibb.co/FVkYLkN
    https://postimg.cc/xcmw7Nx0


    However, the moment I set Emulated Performance > Graphics: Automatic, all I can see is the Switch
    https://ibb.co/31K2NXc
    https://postimg.cc/JyRCj7QR


    All of the elements on PageSettings.qml appear on one's mobile device how I'd hoped it would

    https://ibb.co/FYvVD22
    https://postimg.cc/4nYk6SpH


    Does anybody have any ideas as to how to make the elements appear on the virtual device nicely? Perhaps it's best if I don't debug on it if the issue is with it and not with something I've done


    What I tried to do to work out what was causing the problem

    So PageSettings.qml has this tree (like these are all the children of Window) from what I understand
    Window > StackView > Item > Item > ScrollView > ColumnLayout > (Button, Text, and Switch elements)

    Discovered two things:
    (1) If I move the Item (bolded) contents out of PageSettings.qml and into Main.qml (like unnest it), it appears on the virtual device how it should
    So this nesting makes it appear: Window > Item > ScrollView > ColumnLayout > (Button, Text, and Switch elements)
    Proof of this can be seen here
    https://ibb.co/5Fn2Vz2
    https://postimg.cc/YjTcbzxn

    Surely if it works on one's phone though with the original nesting, it should work as well on the virtual device but that doesn't seem to be the case

    (2) If I keep everything as it was originally but comment out ScrollView (bolded) in PageSettings.qml, it appears on the virtual device

    Proof
    https://postimg.cc/06ZRngtD

    So this nesting makes it appear: Window > StackView > Item > Item > ColumnLayout > (Button, Text, and Switch elements)

    The fact that it works (on the Android Emulator) if I leave out EITHER a StackView or ScrollView and that it works (only a mobile device, not on Android Emulator) if I have both a StackView and ScrollView leads to me believe that it isn't a problem with one's code

    But I could be wrong about this.

    1 Reply Last reply
    0
    • System referenced this topic on
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      Which emulator and which physical device are you using? Are they the same? Same screen size? Portrait or Landscape?

      Software Engineer
      The Qt Company, Oslo

      ? 1 Reply Last reply
      0
      • Axel SpoerlA Axel Spoerl

        Which emulator and which physical device are you using? Are they the same? Same screen size? Portrait or Landscape?

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by A Former User
        #3

        @Axel-Spoerl

        Hello,
        I using emulating on a Galaxy Nexus (x86_64 / Android 13.0 SDK 33 (google APIS) / 720 x 1280 display) . It's like the first one that comes up in the list of virtual devices to emulate on.

        I was also deploying to a motorola g(30) (arm64 / Android 12.0 / 720 x 1600 display I think) physical device

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote on last edited by
          #4

          Well, then you are emulating a different hardware, than the one you physically use.
          That's where the difference comes from.

          Software Engineer
          The Qt Company, Oslo

          ? 1 Reply Last reply
          0
          • Axel SpoerlA Axel Spoerl

            Well, then you are emulating a different hardware, than the one you physically use.
            That's where the difference comes from.

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by A Former User
            #5

            @Axel-Spoerl Are you recommending that I try emulating to a particular device from the available options to see if it makes a difference? I can't say with 100% certainty that the display will have the same issue but it seems to be particular to the Android Emulator like it not displaying either all of the page elements (if I have it set to emulated performance graphics: automatic / https://postimg.cc/RW7z3JKP) or it displaying all the page elements poorly (if I have it set to emulated performance graphics: software / https://postimg.cc/xcmw7Nx0). I'm suspecting it shows up on mobile devices OK but I only have around 3 mobile devices I can test. Also not sure if computer hardware / operating system / etc. makes a difference. Too many variables. Wonder if companies generally deploy to the actual mobile device too like maybe using the Android Emulator is less common in industry

            Edit: Just in process of re-uploading images to different provider as ImgBB servers are down

            1 Reply Last reply
            0
            • Axel SpoerlA Offline
              Axel SpoerlA Offline
              Axel Spoerl
              Moderators
              wrote on last edited by
              #6

              Emulation adds layers to about everything. It's therefore more error-prone and never 100% on the level of a physical device.
              The fact that it works on physical devices, indicates that the issue is more likely to be in the emulation layer, than in Qt.

              Software Engineer
              The Qt Company, Oslo

              1 Reply Last reply
              0

              • Login

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