Jacoco 0.8.2 and Android Gradle plugin 3.2.0 test coverage

为君一笑 提交于 2019-12-11 18:18:34

问题


I just tracked down an issue I'm having with partial coverage reports due to Android Gradle plugin 3.2.0

Jacoco is only generating coverage reports for less than 10% of my project. If I revert back to 3.1.4, it behaves as expected.

Is there any known issue with AGP 3.2.+ and JaCoCo test coverage?


回答1:


In absence of Minimal, Complete, and Verifiable example that demonstrates steps to reproduce your difficulty, one can only guess.

Simple search in bugtracker of Android Gradle Plugin by word "JaCoCo" reveals for example

  • https://issuetracker.google.com/issues/112324134
  • https://issuetracker.google.com/issues/117956165
  • https://issuetracker.google.com/issues/111569276
  • https://issuetracker.google.com/issues/120438249

with the same root cause

Location of class files has changed in newer versions of AGP. You need to change

def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)

to

def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug", excludes: fileFilter)

P.S. side-by-side comparison of old report with a new one can also give hints



来源:https://stackoverflow.com/questions/53860313/jacoco-0-8-2-and-android-gradle-plugin-3-2-0-test-coverage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!