Proper sonar configuration for android projects with linked android sources

I have posted my question on stackoverflow, but so far no answers.

Im looking to find out whether we have anything wrong with our sonar properties, as recently the build outputs have changed on android in gradle 3.5.0. Also i would be interested in knowing more, as in what stands behind each of the properties and what exactly they should link to.


Try using the Scanner for Gradle, it should configure most properties automatically for you.

Hello Julien,
thanks for your reply. We do use Sonar Scanner for Gradle, that’s why I am confused about what properties need to be specified and which will work by default, also taking into consideration the Gradle version we use in our project.

Any help here?

I would remove those properties from your config file, and let the scanner for Gradle infer them from your Gradle build:

    property "sonar.sources", "src/main/java, src/debug/java"
    property "sonar.binaries", "build/intermediates/javac/debug/classes"
    property "", "build/intermediates/javac/debug/classes"
    property "sonar.tests", "src/test/java, src/androidTest/java"

    property "sonar.libraries", libraries
    property "", libraries

    property "", "build/intermediates/javac/debug/classes"

Then let us know if you face some issues.

Just one more question. This blogpost
suggests setting up these properties, although they use sonar scanner plugin. But it is an old version. Can this be why they set up the properties? Or is the blog post completely wrong?

Support of Android projects was initiated in version 2.1 of the Scanner for Gradle, so this may explain why they had to pass all properties manually. Please use latest version of the scanner, and report any issue you may have.