Android Studio Code Coverage Report is Different than


When I run the Code Coverage Report using Android Studio I get about 17.8% of Code coverage whereas on I am only getting only 10.69%

Commit SHAs



CI/CD or Build URL


Codecov Output

Expected Results

Code coverage should be the same as that of android studio

Actual Results

Code coverage is about 7% less on

Additional Information

Originally posted on StackOverflow

Hi @madhurgupta10, would you be able to specify the coverage for a particular file that is showing a difference (file name and the actual lines covered/uncovered)? This will help dig into why you are seeing different coverage numbers.

Hello @tom Please refer

On codecov it says 0% coverage whereas the Android Studio coverage for this file is about 78.8%

I’m looking at the raw build that is uploaded to Codecov and seeing that all those lines are uncovered.

After formatting,

26216     <class name="fr/free/nrw/commons/WelcomeActivity" sourcefilename="">
26217       <method name="&lt;init&gt;" desc="()V" line="19">
26218         <counter type="INSTRUCTION" missed="8" covered="0"/>
26219         <counter type="LINE" missed="2" covered="0"/>
26220         <counter type="COMPLEXITY" missed="1" covered="0"/>
26221         <counter type="METHOD" missed="1" covered="0"/>
26222       </method>
26223       <method name="onCreate" desc="(Landroid/os/Bundle;)V" line="36">
26224         <counter type="INSTRUCTION" missed="45" covered="0"/>
26225         <counter type="BRANCH" missed="6" covered="0"/>
26226         <counter type="LINE" missed="14" covered="0"/>
26227         <counter type="COMPLEXITY" missed="4" covered="0"/>
26228         <counter type="METHOD" missed="1" covered="0"/>
26229       </method>
26230       <method name="onDestroy" desc="()V" line="64">
26231         <counter type="INSTRUCTION" missed="15" covered="0"/>
26232         <counter type="BRANCH" missed="2" covered="0"/>
26233         <counter type="LINE" missed="5" covered="0"/>
26234         <counter type="COMPLEXITY" missed="2" covered="0"/>
26235         <counter type="METHOD" missed="1" covered="0"/>
26236       </method>
26237       <method name="startYourself" desc="(Landroid/content/Context;)V" line="77">
26238         <counter type="INSTRUCTION" missed="10" covered="0"/>
26239         <counter type="LINE" missed="3" covered="0"/>
26240         <counter type="COMPLEXITY" missed="1" covered="0"/>
26241         <counter type="METHOD" missed="1" covered="0"/>
26242       </method>
26243       <method name="onBackPressed" desc="()V" line="86">
26244         <counter type="INSTRUCTION" missed="26" covered="0"/>
26245         <counter type="BRANCH" missed="4" covered="0"/>
26246         <counter type="LINE" missed="6" covered="0"/>
26247         <counter type="COMPLEXITY" missed="3" covered="0"/>
26248         <counter type="METHOD" missed="1" covered="0"/>
26249       </method>
26250       <method name="finishTutorial" desc="()V" line="99">
26251         <counter type="INSTRUCTION" missed="8" covered="0"/>
26252         <counter type="LINE" missed="3" covered="0"/>
26253         <counter type="COMPLEXITY" missed="1" covered="0"/>
26254         <counter type="METHOD" missed="1" covered="0"/>
26255       </method>
26256       <counter type="INSTRUCTION" missed="112" covered="0"/>
26257       <counter type="BRANCH" missed="12" covered="0"/>
26258       <counter type="LINE" missed="33" covered="0"/>
26259       <counter type="COMPLEXITY" missed="12" covered="0"/>
26260       <counter type="METHOD" missed="6" covered="0"/>
26261       <counter type="CLASS" missed="1" covered="0"/>
26262     </class>

You notice that all of the lines shown on Codecov are present here and show them as covered="0". This probably means that you are uploading the wrong coverage report. I would check that Codecov is picking up the right file, or specify the coverage reports using the -f argument.