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

Race condition between androiddeployqt runs for apk and aab package builds

    XMLWordPrintable

Details

    • Android
    • 312717d82 (dev), 4ec2d31d1 (6.8)

    Description

      The function qt6_android_add_apk_target() in Qt6AndroidMacros.cmake is responsible for creating .apk and .aab Android packages when a Qt project is built for Android. It generates these packages by executing the androiddeployqt tool in the background.

      A race condition occurs because the dependency relationship between these two build commands is not explicitly defined in the CMake code. This happens when the androiddeployqt tool occasionally runs simultaneously for both packages (i.e., when the cmake -build command is run with the -parallel argument). The race condition results in "Failed to copy" errors during androiddeployqt executions, as both runs attempt to access and copy the same Android-specific resources to the same target directory simultaneously.

      To resolve this issue, the dependency relationship between these two build commands should be explicitly defined in the CMake code, i.e., like so:

      if(TARGET ${target}_make_apk AND TARGET ${target}_make_aab)
          add_dependencies(${target}_make_aab ${target}_make_apk)
      endif()
      

      NOTE: This does not seem to happen when most Qt example projects are built (because as it seems they disable automatic apk deployment and use qt_generate_deploy_qml_app_script() instead).

      Attachments

        For Gerrit Dashboard: QTBUG-131653
        # Subject Branch Project Status CR V

        Activity

          People

            semlanik Alexey Edelev
            kozmon Ömer Göktaş
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change