'Classes in bundle 'app' do not match with execution data. For report generation the same class files must be used as at runtime
Task :app:jacocoTestReport [ant:jacocoReport] Classes in bundle 'app' do not match with execution data. For report generation the same class files must be used as at runtime. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/feature/login/viewmodel/LoginHelper does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/shared/util/ApplicationExceptionHandler does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/shared/network/PilotConnectNetworkApiService does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/demotesting/ProvideDependency does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/shared/repository/NetworkManager does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/shared/repository/PilotConnectRepository does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/feature/login/viewmodel/IcaoLoginViewModel does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/demotesting/Util does not match. [ant:jacocoReport] Execution data for class com/honeywell/pilotconnectapp/ffapilotconnectandroidapp/feature/common/viewmodel/BaseViewModel does not match.
Jacoco.gradle
apply plugin: 'jacoco'
ext {
coverageExclusions = [
'/Activity.*',
'/R.class',
'/R$*.class',
'/BuildConfig.',
'/App.',
'/Application.',
'/JsonAdapter.',
'/PilotConnectApplication.',
'**/Manifest.',
'**/Test.',
'/com/example/databinding/*',
'/com/example/generated/callback/',
'/databinding/',
'/android/databinding/',
'/androidx/databinding/*',
'/di/module/',
'**/MapperImpl.',
'/$ViewInjector.*',
'/$ViewBinder.',
'**/BuildConfig.',
'/Component.*',
'/BR.',
'**/Manifest.',
'**/$Lambda$.',
'/Companion.*',
'/Module.',
'/Dagger.*',
'/MembersInjector.',
'**/_Factory*.',
'**/_ProvideFactory.',
'**/Extensions.',
'/$Result.', /* filtering sealed and data classes */
'/$Result$.*'
]
}
jacoco { toolVersion = '0.8.7' reportsDir = file("$buildDir/reports") }
tasks.withType(Test) { jacoco.includeNoLocationClasses = true // https://github.com/gradle/gradle/issues/5184#issuecomment-457865951 jacoco.excludes = ['jdk.internal.*'] }
tasks.withType(Test) { finalizedBy jacocoTestReport // report is always generated after tests run }
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { group = "Reporting" description = "Generate Jacoco coverage reports for Debug build"
reports {
xml.required = true
html.required = true
}
def mainSrc = "/src/main/java"
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: coverageExclusions)
def kotlinDebugTree = fileTree(dir: "${buildDir}/tmp/kotlin-classes/debug", excludes: coverageExclusions)
additionalSourceDirs.from = files(mainSrc)
sourceDirectories.from = files([mainSrc])
classDirectories.from = files([kotlinDebugTree], [debugTree])
// classDirectories.from = files([kotlinDebugTree]) executionData.from = files("$buildDir/jacoco/testReleaseUnitTest.exec") }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
