title: android getting coverage on local unit tests
body: <p>I've been trying to get the code coverage for my local unit tests and haven't been successful.</p>
  
  <p>Here's a reference on what I mean by local unit tests.</p>
  
  <p><a href="https://developer.android.com/training/testing/unit-testing/local-unit-tests.html" rel="nofollow">https://developer.android.com/training/testing/unit-testing/local-unit-tests.html</a></p>
  
  <p>To run my unit tests, I use the following gradle command.</p>
  
  <p>./gradlew clean testDebugUnitTest</p>
  
  <p>This task will run the unit tests but when I view the jacoco file that gets generated (testDebugUnitTest.ec) in "build/jacoco" folder, it always shows an empty coverage.</p>
  
  <p>I've enabled the coverage in my build.gradle file as follows.</p>
  
  <pre><code>android {
      buildTypes {
          debug {
              testCoverageEnabled true
          }
      }
  }
  </code></pre>
  
  <p>but that doesn't seem to help.  Is there something that I am missing?</p>
  
  <p>Note that if I run the local unit tests through Android Studio, everything works fine.  I clicked on my "tests" module and click on "Run tests with coverage".</p>