# Missing coverage in Android kotlin project

**URL:** <https://community.sonarsource.com/t/missing-coverage-in-android-kotlin-project/18569>\
**Category:** SonarQube Cloud\
**Tags:** jacoco, kotlin\
**Created:** [January 9, 2020, 1:32pm UTC](https://community.sonarsource.com/t/missing-coverage-in-android-kotlin-project/18569 "2020-01-09T13:32:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwolny](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mwolny](https://community.sonarsource.com/u/mwolny)\
**Post date:** [January 9, 2020, 1:32pm UTC](https://community.sonarsource.com/t/missing-coverage-in-android-kotlin-project/18569/1 "2020-01-09T13:32:52Z")

</div>

Hello,  
we have problems with the code coverage displayed in Sonar Cloud for an Android project written in kotlin.

In short:  
Jacoco report (XML file) is generated, but somehow it’s not uploaded to Sonar Cloud or is uploaded incorrectly - Sonar Cloud still shows 0% of the code coverage.  
We use Azure DevOps pipelines as our CI.

The configuration:

- in our project we use custom jacoco gradle task for building jacoco reports,
- an output of unit tests in form of an \*.exec file is generated as expected,
- the jacoco report in form of XML file is generated correctly and the coverage is not zero (see below),

> ```
> <counter type="INSTRUCTION" missed="68078" covered="12314"/>
> <counter type="BRANCH" missed="3198" covered="306"/>
> <counter type="LINE" missed="11687" covered="1260"/>
> <counter type="COMPLEXITY" missed="5022" covered="812"/>
> <counter type="METHOD" missed="3354" covered="702"/>
> <counter type="CLASS" missed="834" covered="339"/>
> 
> ```

- in our Azure DevOps build pipeline we have added the following tasks:

> Prepare Analysis Configuration  
> Publish Quality Gate Result

- “Prepare Analysis Configuration” contains some advanced properties. One of them is a path to the jacoco report

> sonar.coverage.jacoco.xmlReportPaths=\*\*/reports/test\* Coverage/\*.xml

We are not sure if the XML file is correctly uploaded correctly - is there a possibility to preview the uploaded XML file on Sonar Cloud?

Do you have any hint what should we check? We’re running out of ideas…

Best regards,  
Michał

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [January 16, 2020, 12:44pm UTC](https://community.sonarsource.com/t/missing-coverage-in-android-kotlin-project/18569/2 "2020-01-16T12:44:17Z")

</div>

Hi @mwolny and welcome to the community !

Which scanner are you using for the analysis ?

Thanks.

---

<div class="post-metadata">

**Author:** ![mwolny](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mwolny](https://community.sonarsource.com/u/mwolny)\
**Post date:** [January 23, 2020, 7:38am UTC](https://community.sonarsource.com/t/missing-coverage-in-android-kotlin-project/18569/3 "2020-01-23T07:38:58Z")

</div>

Hi [Mickaël](https://community.sonarsource.com/u/mickaelcaro),  
thanks for your answer.

I finally was able to solve the issue.  
It turned out the problem was related to the Azure Pipeline task “Prepare Analysis Configuration”.

I had to replace the path to an XML file from the one containing asterisk signs

> sonar.coverage.jacoco.xmlReportPaths=\*\*/reports/test\* Coverage/\*.xml

to the full path

> sonar.coverage.jacoco.xmlReportPaths=build/reports/fullNameOfMyTestCoverageDir/fullNameOfCoverageReportFile.xml

Now sonar cloud displays correct values of the code coverage.

---

<div class="post-metadata">

**Author:** ![Margarita\_Nedzelska](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/margarita_nedzelska/32/47493_2.png) [@Margarita\_Nedzelska](https://community.sonarsource.com/u/Margarita_Nedzelska)\
**Post date:** [April 26, 2021, 9:16am UTC](https://community.sonarsource.com/t/missing-coverage-in-android-kotlin-project/18569/4 "2021-04-26T09:16:22Z")

</div>

Closed on April 26, 2021, 9:16am UTC


