I have following setup
- 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
but when trying to run the AndroidTest and generate jacoco report, it fails with
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_3570298/Offline;
After doing my research it seems I need to add jacocoagent.jar to classpath
, but how?
Tried adding testImplementation 'org.jacoco:org.jacoco.agent:0.8.7'
and also downloading jar file from search.maven.org/artifact/org.jacoco/org.jacoco.agent/0.8.7/jar and adding jacoco-agent.properties
file referencing the jar but no success :/ what am I missing...
(things I've looked into:
Removing Jacoco library dependency while exporting project as jar