vanniktech/gradle-android-junit-jacoco-plugin

Update to jacoco 0.8.7

ardevd opened this issue ยท 7 comments

Older Jacoco versions are incompatible with the Kotlin 1.5.x compiler. See this for more information.

However, setting jacocoVersion = '0.8.7'seems to crash tests.

oh, can you share the crash log @ardevd ?
I have plan to upgrade Kotlin to 1.5.0, thus will upgrade jacocoVersion = '0.8.7' too.

I had the same issue with crashing tests when updating to kotlin 1.5.0 or 1.5.10, for some reason upgrading to kotlin 1.5.21 seems to work without issues.

For our projects it still fails with 1.5.21
Ref: nextcloud/android-library#669

Should we still use vanniktech/gradle-android-junit-jacoco-plugin since the author doesn't seem to maintain it?

You need JaCoCO 0.8.7 for Java 11 but compiling the source with Java 11 results in a error. See https://issuetracker.google.com/issues/178400721

The setup we went with is:

  • AGP 7.x+
  • Kotlin 1.5.x+
  • JaCoCo 0.8.7+
  • Java 11 set as the JDK
  • Java 1.8 set as jvmTarget and compileOptions

I believe the problem is AGP 7.x.x in AGP 4.2.2 apparently everything is fine

The setup we went with is:

AGP 4.2.2
Kotlin 1.5.x+
JaCoCo 0.8.7
Java 11 set as the JDK
Java 1.8 set as jvmTarget and compileOptions

Using AGP 7.0.2 is simply not generating jacoco in Android modules
2021-09-04_20-58

I faced same issue after updating AGP from 4.2.2 to 7.0.4, jacoco folder was missing in build dir.

My current setup:
AGP 7.0.4
Kotlin 1.6.10
JaCoCo 0.8.7
Java 11 set as the JDK
Java 1.8 set as jvmTarget and compileOptions

I had to change execution data path in jacoco.gradle using executionData.from = files("${project.buildDir}/outputs/unit_test_code_coverage/sandboxDebugUnitTest/testSandboxDebugUnitTest.exec")

Screenshot 2022-01-01 at 15 17 24