Open atk1993 opened 8 months ago
I found a few problems with this issue:
I too am seeing this. It seems very similar to https://github.com/firebase/firebase-android-sdk/issues/3948. If I comment out the performance plugin from a target module, coverage reports generate fine with accurate coverage numbers. If I apply the performance plugin, coverage numbers show as zero.
we have the same issue
hey @raymondlam! 👋🏼 sorry for tagging you directly but I saw your comment and it seems like the issue is back, I'm using AGP v8.3.1 and Jacoco is reporting 0% after Firebase Performance Monitoring plugin integration. Do you know how to workaround this? It's being a blocker for us to integrate FPM in our project.
@epool Try as below
in Jacoco.gradle file
final def debugTree = [fileTree(
dir: "${getLayout().getBuildDirectory()}/intermediates/asm_instrumented_project_classes/${testTaskName}",
def intermediateClassesPath = "${getLayout().getBuildDirectory()}/intermediates/javac/${srcName}/classes"
def kotlinClassesPath = "${getLayout().getBuildDirectory()}/intermediates/asm_instrumented_project_classes/${srcName}"
still actual with AGP 8.2.2 and tried with 8.5.0 - reproducing too.
as workaround may helped:
List<ConfigurableFileTree> classesFileList
if (android.hasProperty('applicationVariants')) {
classesFileList = [fileTree(dir: "${layout.buildDirectory.asFile.get().path}/intermediates/classes/${variantName}/transform${variantName.capitalize()}ClassesWithAsm/dirs", excludes: excludes)]
} else {
def javaClasses = fileTree(dir: variant.javaCompileProvider.get().destinationDir, excludes: excludes)
def kotlinClasses = fileTree(dir: "${layout.buildDirectory.asFile.get().path}/tmp/kotlin-classes/${variantName}", excludes: excludes)
classesFileList = [javaClasses, kotlinClasses]
}
classDirectories.setFrom(files(classesFileList))
when use firebase performance plugin class files from build/tmp/kotlin-classes can't recognition by Jacoco reported, probably it's modified. In logs message like Execution data for class does not match
. With class files from build/intermediates/classes for me works ok.
My environment
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
I have integrated firebase performance SDK. Logs can be seen in portal too. Code Coverage was fine before integrating this SDK.
However, after integrating, jaCoCo code coverage is not working, very low code coverage is getting reported.
I tried running local test coverage but it shows 0 classes covered. I have disabled the performance SDK for compile time for all type s of build. (https://firebase.google.com/docs/perf-mon/disable-sdk?platform=android#disable-gradle-plugin).
According to https://github.com/firebase/firebase-android-sdk/issues/3948#issuecomment-1315677731 this will be fixed in AGP 8.0.
But I am still facing this even using AGP 8.0.2