Android - Jacoco code coverage ignores Robolectric tests

柔情痞子 提交于 2019-11-30 19:48:44

I don't see you build.gradle completely, but to have that flag in you have to:

  1. Use gradle 2.13+
  2. Use jacoco 0.7.6.201602180812

You're sure that you use gradle proper version. So, I think, the issue is only in using wrong jacoco.

Mentioning jacoco {toolVersion = "0.7.6.201602180812"} doesn't influence gradle DSL. You should add newer jacoco plugin:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'org.jacoco:org.jacoco.core:...'
    }
}

And you should apply plugin, which you're already doing:

apply from: 'jacoco'

After such configuraiton you don't need jacoco {toolVersion = "..."} more.

Note: consider to update to newer android gradle plugin, 2.2.x is already stable. jacoco also has newer version already 0.7.7.201606060606

One more note: if you see original issue in Android Studio, check that you use wrapper by default and check that you pointed wrapper to gradle 2.13

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