Reputation: 23394
I want to generate code coverage for my project so I have added ,
debug {
testCoverageEnabled true
}
When i run command gradlew createDebugCoverageReport
I get the following error
Execution failed for task ':app:createDebugAndroidTestCoverageReport'.
> A failure occurred while executing com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction
>Unable to generate Jacoco report
Using same gradle version and kotlin version worked in sample project , Its giving error in my main project .
Upvotes: 5
Views: 2098
Reputation: 21129
If in-case, if you use build.gradle.kts
plugins {
...
jacoco
}
jacoco {
toolVersion = "0.8.7"
}
configurations.all {
resolutionStrategy {
eachDependency {
if (requested.group == "org.jacoco") {
useVersion("0.8.7")
}
}
}
}
Upvotes: 2
Reputation: 23394
After a lot of research I found out it was problem with jacoco , Thanks to this issue and its commentors in youtrack which pointed me out in right direction . To fix the issue upgrade the jacoco to version 0.8.7
in app level build.gradle
file add these following lines
plugins{
...
id 'jacoco'
}
jacoco {
toolVersion = "0.8.7"
}
android {
...
}
dependencies{
...
}
configurations.all{
resolutionStrategy {
eachDependency { details ->
if ('org.jacoco' == details.requested.group) {
details.useVersion "0.8.7"
}
}
}
}
I am not sure why it worked in sample app
Upvotes: 8