Issue
Today I updated gradle and kotlin dependencies in android studio.
The new versions are these:
kotlin_version = "1.5.10"
...
jacoco {
toolVersion = "0.8.6"
}
...
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
The test coverage report task fails with the following error:
2021-05-27T16:57:49.150+0200 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':consumerkit:testDebugUnitTestCoverage'.
2021-05-27T16:57:49.304+0200 [DEBUG] [org.codehaus.groovy.vmplugin.VMPluginFactory] Trying to create VM plugin `org.codehaus.groovy.vmplugin.v9.Java9` by checking `java.lang.Module`, but failed:
java.lang.ClassNotFoundException: java.lang.Module
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.groovy.vmplugin.VMPluginFactory.lambda$createPlugin$0(VMPluginFactory.java:61)
at java.security.AccessController.doPrivileged(Native Method)
Solution
For Kotlin 1.5
you should use JaCoCo 0.8.7
instead of 0.8.6
- see https://github.com/jacoco/jacoco/pull/1164 and the full changelog at https://www.jacoco.org/jacoco/trunk/doc/changes.html
Example snippet:
// build.gradle or build.gradle.kts
jacoco {
toolVersion = "0.8.7"
}
Answered By - Godin
Answer Checked By - Gilberto Lyons (JavaFixing Admin)