Uploaded image for project: 'Qt Tools for Android'
  1. Qt Tools for Android
  2. QTTA-368

QtBuildTask does not add itself as a dependency if flavored products

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • QtGP 1.3
    • QtGP 1.2
    • QtGP: General
    • None
    • All
    • 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:

      1. Create an Android project with Quick4Android integration using the Qt Gradle Plugin.
      2. 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"
                }
            }
        }

         
         

      1. Sync the project with Gradle.
      2. Run a build.
      3. 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

          For Gerrit Dashboard: QTTA-368
          # Subject Branch Project Status CR V

          Activity

            People

              nikunj Nikunj Arora
              soarmin Soheil Armin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes