Seemed like adding Jacoco to an Android project would be a straightforward process, but so far it's been nothing but pain.
Having tried a few guides to getting it working, this one seems to give the best results for me so far:
But shortly after it all goes wrong. Turns out that to use kotlin 1.5+ (which the project I'm adding to does) you need to use jacoco version 0.8.7 or higher. So I've done that.
But using versions of jacoco beyond 0.8.3 causes the build to fail with complaints about $jacocoData.
A search on the error message from that suggests setting the compile/target versions to VERSION_1_8 instead of VERSION_11. Okay, give that a go, but then the build fails with errors like:
> Duplicate class com.google.android.gms.common.api.internal.zza found in modules jetified-play-services-base-15.0.1-runtime (com.google.android.gms:play-services-base:15.0.1) and jetified-play-services-basement-17.2.1-runtime (com.google.android.gms:play-services-basement:17.2.1)
Is there a clear guide anywhere to getting code coverage data out of an Android project written in Java 11 and kotlin 1.5+ with multiple variants? Because this is something that seems like it should be easy but is actually turning out to be incredibly painful...