如何使用createDebugCoverageReport在Android项目中获得Jacobo覆盖



我有以下项目。。。

plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
testImplementation 'junit:junit:4.13.2'
implementation 'org.jacoco:org.jacoco.core:0.8.6'
}
android {
compileSdk 32
defaultConfig {
minSdk 24
targetSdk 32
}
jacoco {
version = '0.8.6'
}
buildTypes {
release {
minifyEnabled true
}
debug {
minifyEnabled false
testCoverageEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
}

但当我运行ANDROID_HOME=/.../Android/sdk gradle clean assembleDebug createDebugCoverageReport --stacktrace时,我会得到

意外的SMAP行:*S KotlinDebug

上面的错误似乎表明它没有忽略构建文件夹。。。

java.io.IOException:分析/…时出错/StudioProjects/android纯移动应用程序//build/tmp/kotlin classes/debug//core/extensions/Enum_TypeByValueKt.class.

但我不确定,也不知道如何排除目录。

如何配置Android以生成XML Jacobo报告?

使用jacoco 0.8.7。此版本修复了Kotlin 1.5的SMAP解析https://github.com/jacoco/jacoco/pull/1164

最新更新