jacoco-android-gradle-plugin
jacoco-android-gradle-plugin copied to clipboard
When are we supporting gradle distribution gradle-6.1.1
Currently gradle sync will fail stating Cannot set the value of read-only property 'executionData' for task ':app:jacocoTestInternalDebugUnitTestReport' of type org.gradle.testing.jacoco.tasks.JacocoReport. when upgrade to gradle-6.1.1
I didn't see it documented anywhere, but a bunch of blog posts and stackoverflow answers pointed me at replacing executionData = fileTree(...) with executionData.from fileTree(...) or alternatively .setFrom (...). I haven't dug deeper yet, but both replacement variants work for me with Gradle plugin 6.1.1 and above
The same issue. AndroidStudio is ready for 6.1.1 for already some time.
Yes, please update to gradle 6.1.1
Gradle upgrade says clearly what changed for Jacoco: https://docs.gradle.org/current/userguide/upgrading_version_5.html#other_deprecated_behaviors_and_apis
Apparently, on the class JacocoAndroidPlugin, line 73, this
reportTask.executionData.setFrom(project.files(executionData))
should be replaced by
reportTask.getExecutionData().setFrom(project.files(executionData))
Hi guys, you can use 0.1.5-SNAPSHOT. It works fine because fixed in snapshot version. @arturdm could you please release it as stable in order to fix the problem for latest gradle?
@lion4ik I don't find this version :/
You can use https://plugins.gradle.org/plugin/com.hiya.jacoco-android as a temp solution till jacoco-android-gradle-plugin support 6.1.1. It is a fork fixes the issue by @autonomousapps.
These are the required changes
https://github.com/ryoyakawai/uitest_sample_android/commit/0982e46f02354f1dbaad4d8ec035bfc04f407dfa
Would it be possible to have a released version ?
I have made my fork open source (apologies for somehow missing this earlier). Obviously this repo is no longer maintained. https://github.com/hiyainc-oss/android-jacoco
@lion4ik I don't find this version :/
try this way:
buildscript {
repositories {
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' }
}
dependencies {
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.5-SNAPSHOT'
}
}
It worked for me.
Since Artur is not updating this plugin, I decided to go with another solution following this tutorial -> https://www.rallyhealth.com/coding/code-coverage-for-android-testing (took me like 20 minutes)
Basically, what you need to do is remove this plugin and use Jacoco plugin directly, and then just add task jacocoUnitTestReport to your app's gradle file (You'll find it in the tutorial above).
Anyway just follow the tutorial, but notice - it's a bit outdated, so you will have to remove this line from that jacocoUnitTestReport task
$buildDir = // Location of the build directory for the build Variant
and also, use classDirectories.from = ..., additionalSourceDirs.from =... etc. instead of classDirectories = ... since it's deprecated.