Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.0
-
None
-
Tested on Linux and macOS.
-
-
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
Gerrit Reviews
For Gerrit Dashboard: QTBUG-131653 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
609196,1 | Use add_dependencies to add the Android custom target dependencies | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: NEW | 0 | 0 |
607431,5 | Use add_dependencies to add the Android custom target dependencies | dev | qt/qtbase | Status: MERGED | +2 | 0 |
607492,2 | Use add_dependencies to add the Android custom target dependencies | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |