Uploaded image for project: 'SonarQube Scanner for Gradle'
  1. SonarQube Scanner for Gradle
  2. SONARGRADL-22

Don't fail with NPE when there is no debug variant

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None

      Description

      I assumed there is always at least one debug variant since it is automatically created by the android plugin. But in fact it is possible for a user to disable the debug variant using such code:

      android.variantFilter { variant ->
        if(variant.buildType.name.equals('debug')) {
          variant.setIgnore(true);
        }
      }
      

      When there is no debug variant, we should fallback to use the first variant, whatever is the build type.

      The workaround is to manually specify the variant to be used:

      sonarqube {
        androidVariant = "xxxxx"
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julien.henry Julien Henry
                Reporter:
                julien.henry Julien Henry
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: