gradle-android-junit-jacoco-plugin icon indicating copy to clipboard operation
gradle-android-junit-jacoco-plugin copied to clipboard

Update to jacoco 0.8.7

Open ardevd opened this issue 4 years ago • 7 comments
trafficstars

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.

ardevd avatar May 28 '21 07:05 ardevd

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.

trietbui85 avatar Jun 19 '21 04:06 trietbui85

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.

ilians avatar Jul 26 '21 07:07 ilians

For our projects it still fails with 1.5.21 Ref: https://github.com/nextcloud/android-library/pull/669

tobiasKaminsky avatar Aug 03 '21 10:08 tobiasKaminsky

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

trietbui85 avatar Aug 03 '21 15:08 trietbui85

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

dsuresh-ap avatar Aug 31 '21 13:08 dsuresh-ap

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

jakubdzubak1 avatar Jan 01 '22 14:01 jakubdzubak1