Sonarqube jacoco coverage path not picking up even after setting with Android

Android Gradle config:

  • SonarQube (android, via plugin - id “org.sonarqube” version “3.3”)
  • SonarServer locally run (sonarqube- windows)
  • Jacoco 0.8.7
  • Sonarqube property not picking up jacoco generated XML report path

Till now,

basically, I have multi-module app

  • app
  • data

In project-level build.gradle, applied jacoco.gradle to its all sub-modules

subprojects { Project module →
if ( == ‘app’) {
apply plugin: ‘’
} else {
apply plugin: ‘’
apply from: ‘…/jacoco.gradle’

and here’s my a snippet of jacoco.gradle

FileTree getJacocoClassDirs(List fileFilter) {
    def classDirs = files().asFileTree
    classDirs += fileTree(dir: "$project.rootDir/$", excludes: fileFilter)
    classDirs += fileTree(dir: "$project.rootDir/$", excludes: fileFilter)
    return classDirs

task generateJacocoTestReport(type: JacocoReport) {
    dependsOn ":$"
    group = 'Reporting'
    description = "Generate Jacoco coverage reports for the debug build. Only unit tests."
    executionData.from = files(executionData.findAll { it.exists() })
    additionalSourceDirs.from = files("$project.rootDir/$")
    sourceDirectories.from = files("$project.rootDir/$")
    classDirectories.from = getJacocoClassDirs(fileFilter)
    executionData.from = fileTree(dir: project.rootDir, includes: ["$"])
    reports {
        html.enabled = true
        xml.enabled = true
        csv.enabled = false

So, jacoco correctly generates two different jacoco reports as per my modules i.e. app and data and
location is “build/reports/jacoco/generateJacocoTestReport/generateJacocoTestReport.xml

so, in my sonarqube.gradle which is defined in project-level build.gradle

sonarqube {
    properties {
        property "sonar.language", "kotlin"
        property "sonar.sourceEncoding", "UTF-8"
        property "sonar.sources", "src/main/java"
        property "sonar.tests", "src/test/java"
        property "sonar.junit.reportPaths", "build/test-results/testDebugUnitTest"
        property "sonar.core.codeCoveragePlugin", "jacoco"
        property "sonar.coverage.jacoco.xmlReportPaths", 'build/reports/jacoco/generateJacocoTestReport/generateJacocoTestReport.xml'
        property "sonar.binaries", "build/intermediates/classes/debug, build/tmp/kotlin-classes/debug"
        property "", "build/intermediates/classes/debug, build/tmp/kotlin-classes/debug"
        property "", "build/intermediates/classes/test/, build/tmp/kotlin-classes/debugUnitTest"


Now, when I execute ./gradlew sonarqube
I can see

> No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths=‘build/reports/jacoco/generateJacocoTestReport/generateJacocoTestReport.xml’. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.x
> ml

you can clearly see the path is a valid location.

I am not sure what I am doing wrong here,
Any guidance will be greatly appreciated.


Welcome to the community!

Most of those properties should be picked up automatically from the Gradle context. Can you try commenting out or removing all your properties & re-analyzing?