I have a simple Kotlin classes, as below
class MyClass {
fun justSayHello(yes: Boolean): String {
if (yes) {
return \"Hello\"
In case anyone is still looking for a solution, adding in a gradle task to copy the cases from the tmp directory into the directory that the coverage output looks in helps with this issue as a workaround.
For example add copyTestClasses to your module gradle file
task copyTestClasses(type: Copy) {
from "build/tmp/kotlin-classes/debug"
into "build/intermediates/classes/debug"
}
And then setting up your defaults to run the gradle task before running the tests
It can help to find both of the directories in your project manually before trying to point to them using gradle, to make sure that you're pointing to the right place (flavours will change the directories that you need to point to)