I'm getting coverage reports from the Android tests (instrumented tests). I'm using the gradle plugin and have set the flag isTestCoverageEnabled
true. At CI I run tests using ADB (not gradle) and this generates the .ec files. I need to generate xml/html report. For this I have added a new task
tasks.register("coverageReportFromInstrumentationTest", JacocoReport::class.java)
I configure the:
executionData
classDirectories
sourceDirectories
for JacocoReport. I'm able to get the xml report when I give the classdirectories from the build folder for Java/Kotlin
My issue is that on CI I do not have these generated class files. I have only the apk. So I unzipped the apk and dex.jar to get the class files and used that to configure classDirectories. But when I use the class directories from the apk, I am getting the exception
Cannot process instrumented class. Please supply original non-instrumented classes
I think this is because the class files in apk is already instrumented to generate the .ec file. So is there a way to tell JacocoReport task to not to instrument the classes again as it is already instrumented? Or is there any other approach I can use here.