Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
QtGP 1.2
-
None
-
-
6c803d9a7 (dev), da1b0192c (1.3)
Description
When a project uses Android build flavors (as described in Android Build Variants), QtGP fails to add the QtBuildTask as a dependency to any suitable tasks.
In projects configured with build flavors, the QtGP does not correctly register the QtBuildTask as a dependency for the appropriate build tasks. This results in the Qt-related build steps being skipped during the build process, potentially causing incomplete or failed builds for Qt Quick for Android applications.
Root Cause:
Android Gradle Plugin (AGP) is generating task names differently when build flavors are defined. QtGP rely on a specific task naming that does not account for the modified task names introduced by build flavors, leading to a failure in identifying and hooking into the correct tasks.
Steps to Reproduce:
- Create an Android project with Quick4Android integration using the Qt Gradle Plugin.
- Configure the project to include at least one build flavor (e.g., free and paid) in the build.gradle file.
android { flavorDimensions "type" productFlavors { free { dimension "type" } paid { dimension "type" } } }
- Sync the project with Gradle.
- Run a build.
- QtBuildTask is not executed as part of the build process.
Expected Behavior:
The QtGP should correctly identify the appropriate build tasks (e.g., assembleFreeDebug, assemblePaidRelease) and register the QtBuildTask as a dependency, ensuring that Qt-specific build steps are executed for all build variants and flavors.
Actual Behavior:
The QtBuildTask is not added as a dependency to any build tasks when flavors are present, causing Qt-related build steps to be skipped.
Possible improvement when fixing:
QtGP currently uses a hard-coded set of tasks, primarily assemble tasks, to register the QtBuildTask as a dependency. Adding QtBuildTask as a dependency to compile* tasks would improve the user experience. This change would prevent build failures caused by missing AAR target, which QtBuildTask generates, avoiding issues such as "unresolved import" or "unavailable class" errors.
Attachments
Issue Links
- is required for
-
QTTA-311 Qt Gradle Plugin 1.3
-
- Closed
-
For Gerrit Dashboard: QTTA-368 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
645738,1 | Add wildcard to task names on which to add QtBuildTask dependency | dev | qt-labs/qtgradleplugin | Status: ABANDONED | 0 | 0 |
647427,2 | Add docs for how to add dependency on QtBuildTask for custom flavors | dev | qt-labs/qtgradleplugin | Status: MERGED | +2 | 0 |
647752,2 | Add docs for how to add dependency on QtBuildTask for custom flavors | 1.3 | qt-labs/qtgradleplugin | Status: MERGED | +2 | 0 |