Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99221

Android app randomly crashes.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.2
    • Quick: Other
    • None
    • Android

    Description

      I was able to write an app that crashes at startup, see the attachment.

      Probably I have a broken environment or some unlucky QT build, but at least on my machine I am able to stably reproduce the crash with the following steps:

      1. Build the app with QT 6.2.2 for Android arm64-v8a.
      2. Run the app on an x86_64 emulator with Android 11+ (fresh x86_64 emulator supports arm64-v8a apps)

      (or, alternatively, install APK from attachment).

      Also if I comment `showControlsPage()` out in main.qml and uncomment `showHowToPlayPage()` the app crashes when I try to drag (or scroll) the page content.

      Not that x86_x64 app does not crash, for example, and arm64-v8a app does not crash on my real device with Android 8.

      I do not have real devices with Android 11+, so I did not try to run the app on them.

      The commands to run the app:

      adb install android-build-debug.apk
      adb shell am start -n org.qtproject.example.AppWithBug/org.qtproject.qt.android.bindings.QtActivity
      adb uninstall org.qtproject.example.AppWithBug
      

      Crash log contains some anonymous stack frame so it is not clear where the crash goes from:

      12-15 05:01:05.430 25977 26000 F libc    : Fatal signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0x7dcb982d2f90 in tid 26000 (qtMainLoopThrea), pid 25977 (mple.AppWithBug)
      12-15 05:01:05.450  1278  1278 D BoundBrokerSvc: onUnbind: Intent { act=com.google.android.gms.scheduler.ACTION_PROXY_SCHEDULE cmp=com.google.android.gms/.chimera.PersistentInternalBoundBrokerService }
      12-15 05:01:05.494 26016 26016 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
      12-15 05:01:05.494   274   274 I tombstoned: received crash request for pid 26000
      12-15 05:01:05.494 26016 26016 I crash_dump64: performing dump of process 25977 (target tid = 26000)
      12-15 05:01:05.499 26016 26016 E DEBUG   : failed to read /proc/uptime: Permission denied
      12-15 05:01:05.632     0     0 I logd    : logdr: UID=10156 GID=10156 PID=26016 n tail=0 logMask=8 pid=25977 start=0ns deadline=0ns
      12-15 05:01:05.638     0     0 I logd    : logdr: UID=10156 GID=10156 PID=26016 n tail=0 logMask=1 pid=25977 start=0ns deadline=0ns
      12-15 05:01:05.662 26016 26016 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      12-15 05:01:05.662 26016 26016 F DEBUG   : Build fingerprint: 'google/sdk_gphone64_x86_64/emulator64_x86_64_arm64:12/S2B1.211112.006/7934767:userdebug/dev-keys'
      12-15 05:01:05.663 26016 26016 F DEBUG   : Revision: '0'
      12-15 05:01:05.663 26016 26016 F DEBUG   : ABI: 'x86_64'
      12-15 05:01:05.663 26016 26016 F DEBUG   : Timestamp: 2021-12-15 05:01:05.499464000+0000
      12-15 05:01:05.664 26016 26016 F DEBUG   : Process uptime: 0s
      12-15 05:01:05.664 26016 26016 F DEBUG   : Cmdline: org.qtproject.example.AppWithBug
      12-15 05:01:05.664 26016 26016 F DEBUG   : pid: 25977, tid: 26000, name: qtMainLoopThrea  >>> org.qtproject.example.AppWithBug <<<
      12-15 05:01:05.664 26016 26016 F DEBUG   : uid: 10156
      12-15 05:01:05.665 26016 26016 F DEBUG   : signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0x7dcb982d2f90
      12-15 05:01:05.665 26016 26016 F DEBUG   :     rax dbe70152b92c0950  rbx 3ff0000000000000  rcx 00007dc177c5d820  rdx 00007dcb39fca7f8
      12-15 05:01:05.665 26016 26016 F DEBUG   :     r8  00007dcb3d0d3838  r9  0000000000008200  r10 0000000000000000  r11 0000000000000000
      12-15 05:01:05.665 26016 26016 F DEBUG   :     r12 00007dcb983b8cf0  r13 0000000000000000  r14 00007dcb3d0d3b98  r15 0000000000000000
      12-15 05:01:05.667 26016 26016 F DEBUG   :     rdi 00007dcb39fca7f0  rsi 00007dcb39fca7e8
      12-15 05:01:05.667 26016 26016 F DEBUG   :     rbp 00007dce49c53050  rsp 00007dcb39fca7d8  rip 00007dcb982d2f90
      12-15 05:01:05.667 26016 26016 F DEBUG   : backtrace:
      12-15 05:01:05.667 26016 26016 F DEBUG   :       #00 pc 00000000000cff90  /system/lib64/libndk_translation.so (ndk_translation::intrinsics::MulAdd(ndk_translation::intrinsics::WrappedFloatType<double> const&, ndk_translation::intrinsics::WrappedFloatType<double> const&, ndk_translation::intrinsics::WrappedFloatType<double> const&)+0) (BuildId: 650805f4b6b3978937ab1246e7d75020)
      12-15 05:01:05.667 26016 26016 F DEBUG   :       #01 pc 00000000000cfd77  /system/lib64/libndk_translation.so (std::__1::tuple<ndk_translation::intrinsics::WrappedFloatType<double> > ndk_translation::intrinsics::MulAddF64<false>(ndk_translation::intrinsics::WrappedFloatType<double>, ndk_translation::intrinsics::WrappedFloatType<double>, ndk_translation::intrinsics::WrappedFloatType<double>)+55) (BuildId: 650805f4b6b3978937ab1246e7d75020)
      12-15 05:01:05.667 26016 26016 F DEBUG   :       #02 pc 0000000000002c62  <anonymous:7dcb0db9e000>
      

      I build QT as follows:

      For Windows:

      CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
         
      set "CMAKE_ROOT=E:\PFiles\cmake-3.21.3-windows-x86_64\bin"
      set "NINJA_ROOT=E:\PFiles\ninja-win"
      set "PERL_ROOT=E:\PFiles\Strawberry\perl\bin"
          
      set PATH=%CMAKE_ROOT%;%PATH%
      set PATH=%NINJA_ROOT%;%PATH%
      set PATH=%PERL_ROOT%;%PATH%
      set PATH=E:\PFiles\Python35;%PATH%
            
      rem Check if the tools are in PATH
      where perl.exe
      where python.exe
      where cmake.exe
      where ninja.exe
        
      set "MY_INSTALL_PATH=E:\Qt\Qt6.2.2\windows"
      set CL=/MP
        
      configure.bat -prefix %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -debug-and-release -force-debug-info -platform win32-msvc -opensource -confirm-license ^
      -opengl es2 -I "C:\Program Files\OpenSSL\include" -L "C:\Program Files\OpenSSL\lib"
      

      For Android:

      set "CMAKE_ROOT=E:\PFiles\cmake-3.21.3-windows-x86_64\bin"
      set "NINJA_ROOT=E:\PFiles\ninja-win"
      set "JDK_ROOT=C:\Program Files\Java\jdk-11.0.11\bin"
      set "MINGW_ROOT=E:\PFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin"
      set "PERL_ROOT=E:\PFiles\Strawberry\perl\bin"
             
      set PATH=C:\WINDOWS\system32;C:\WINDOWS
      set PATH=%CMAKE_ROOT%;%PATH%
      set PATH=%NINJA_ROOT%;%PATH%
      set PATH=%JDK_ROOT%;%PATH%
      set PATH=%MINGW_ROOT%;%PATH%
      set PATH=%PERL_ROOT%;%PATH%
      set PATH=E:\PFiles\Python35;%PATH%
               
      rem Check if the tools are in PATH
      where gcc
      where mingw32-make.exe
      where perl.exe
      where javac.exe
      where python.exe
      where cmake.exe
      where ninja.exe
            
      set "ANDROID_SDK_ROOT=C:\Users\D-Ef\AppData\Local\Android\Sdk"
      set "ANDROID_NDK_PATH=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk\22.1.7171670"
      set "ANDROID_BUILD_TOOLS_REVISION=31.0.0"
             
      set MY_ABI=%1
      set MY_INSTALL_PATH=E:\Qt\Qt6.2.2\android
      set QT_HOST_PATH=E:\Qt\Qt6.2.2\windows
      set MY_INSTALL_PATH=%MY_INSTALL_PATH%.%MY_ABI%
      echo QT will be installed to %MY_INSTALL_PATH%
            
      configure.bat -platform win32-msvc -xplatform android-clang -prefix %MY_INSTALL_PATH% -qt-host-path %QT_HOST_PATH% ^
        -c++std c++20 -no-openssl -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -opensource -confirm-license ^
        -android-sdk %ANDROID_SDK_ROOT% -android-ndk %ANDROID_NDK_PATH% -android-ndk-platform android-23 -android-abis %MY_ABI% ^
        -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
        -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
        -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
        -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland -skip qtwebsockets ^
        -skip qtwebchannel -skip qtwebengine -skip qtwebview ^
        1> E:\temp\config-log-%1%2.txt 2>&1
      

      where %1 = arm64-v8a, %2 = ""

      Also I configured QT Creator 5 in %SystemDrive%\Documents and Settings%USERNAME%\Application Data\QtProject\qtcreator\android\sdk_definitions.json as follows:

      {
          "common": {
              "sdk_tools_url": {
                  "linux": "https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip",
                  "linux_sha256": "89f308315e041c93a37a79e0627c47f21d5c5edbe5e80ea8dc0aac8a649e0e92",
                  "windows": "https://dl.google.com/android/repository/commandlinetools-win-6609375_latest.zip",
                  "windows_sha256": "40bba20275180194bebf89bb58c74d712bb93cc401f36bd2f8f32383acf9826c",
                  "mac": "https://dl.google.com/android/repository/commandlinetools-mac-6609375_latest.zip",
                  "mac_sha256": "2c3822db1c916655223e5ee8ce0fbf6b73d0b99012045c9dc8eaa6a5736c0c55"
              },
              "sdk_essential_packages": {
                  "default": ["platform-tools", "platforms;android-31", "cmdline-tools;latest"],
                  "linux": [],
                  "mac": [],
                  "windows": ["extras;google;usb_driver"]
              }
          },
          "specific_qt_versions": [
              {
                  "versions": ["default"],
                  "sdk_essential_packages": ["build-tools;31.0.0", "ndk;22.1.7171670"],
                  "ndk_path": "ndk/22.1.7171670"
              },
              {
                  "versions": ["5.12.[0-5]", "5.13.[0-1]"],
                  "sdk_essential_packages": ["build-tools;28.0.2", "ndk;19.2.5345600"],
                  "ndk_path": "ndk/19.2.5345600"
              }
          ]
      

      My OS: Windows 10

      My Android Studio Version: see attachment

      My Emulator:

      Name: Pixel_4_API_31
      CPU/ABI: Google Play Intel Atom (x86_64)
      Path: C:\Users\D-Ef\.android\avd\Pixel_4_API_31.avd
      Target: google_apis_playstore [Google Play] (API level 31)
      Skin: pixel_4
      SD Card: 512M
      fastboot.chosenSnapshotFile: 
      runtime.network.speed: full
      hw.accelerometer: yes
      hw.device.name: pixel_4
      hw.lcd.width: 1080
      hw.initialOrientation: Portrait
      image.androidVersion.api: 31
      tag.id: google_apis_playstore
      hw.mainKeys: no
      hw.camera.front: emulated
      avd.ini.displayname: Pixel 4 API 31
      hw.gpu.mode: auto
      hw.ramSize: 1536
      PlayStore.enabled: true
      fastboot.forceColdBoot: no
      hw.cpu.ncore: 4
      hw.keyboard: yes
      hw.sensors.proximity: yes
      hw.dPad: no
      hw.lcd.height: 2280
      vm.heapSize: 256
      skin.dynamic: yes
      hw.device.manufacturer: Google
      hw.gps: yes
      hw.audioInput: yes
      image.sysdir.1: system-images\android-31\google_apis_playstore\x86_64\
      showDeviceFrame: yes
      hw.camera.back: virtualscene
      AvdId: Pixel_4_API_31
      hw.lcd.density: 440
      hw.arc: false
      hw.device.hash2: MD5:6b5943207fe196d842659d2e43022e20
      fastboot.forceChosenSnapshotBoot: no
      fastboot.forceFastBoot: yes
      hw.trackBall: no
      hw.battery: yes
      hw.sdCard: yes
      tag.display: Google Play
      runtime.network.latency: none
      disk.dataPartition.size: 6442450944
      hw.sensors.orientation: yes
      avd.ini.encoding: UTF-8
      hw.gpu.enabled: yes
      

      Attachments

        1. android-build-debug.apk
          18.80 MB
        2. android-studio-version.png
          android-studio-version.png
          31 kB
        3. AppWithBug.zip
          75 kB
        4. native-debug-symbols.zip
          21.30 MB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            dmitriano Dmitry Efimov
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes