Member-only story

Add SonarQube and JaCoCo in a multimodule Android project built with an Azure DevOps pipeline

Erick Medina
6 min readSep 17, 2023

--

I’m currently working in an Android SDK with its Companion App, and one of the objectives of this project was to setup for this project static code analysis and code coverage statistics as part of its integration process.

We are working with Azure DevOps pipelines, and have selected SonarQube for static code analysis and JaCoCo for code coverage.

Our android project has two modules, one is the app (:app) and the other is the android library named sdk (:sdk).

Add SonarQube in gradle and the pipeline

Most SonarQube integration tutorials in the internet are done using Groovy, but now Kotlin is the official language for gradle, so some adaptations are needed.

First we need to add the latests version od the SonarQube gradle plugin in our project’s root build.gradle.kts.

plugins {
...
id("org.sonarqube") version "4.3.1.3277"
}

Now we configure the :sdk build.gradle.kts file with the sonar task.

plugins {
...
id("org.sonarqube")
}

... //All other android tasks

sonar {
properties {
property("sonar.sourceEncoding", "UTF-8")
property("sonar.sources"…

--

--

Responses (1)