Facing this problem while trying to implement JaCoCo Offline Instrumentation.
W/System.err( 1733): java.io.FileNotFoundException: /jacoco.exec: open failed: EROFS (Read-only file system)
W/System.err( 1733): at libcore.io.IoBridge.open(IoBridge.java:456)
W/System.err( 1733): at java.io.FileOutputStream.<init>(FileOutputStream.java:89)
--
W/System.err( 1733): at libcore.io.IoBridge.open(IoBridge.java:456)
W/System.err( 1733): at java.io.FileOutputStream.<init>(FileOutputStream.java:89)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.output.FileOutput.openFile(FileOutput.java:67)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.output.FileOutput.startup(FileOutput.java:49)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.Agent.startup(Agent.java:122)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.Agent.getInstance(Agent.java:50)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.Offline.<clinit>(Offline.java:31)
The solution is well-documented in jacoco but for Android people, what you need is to add the file in /src/androidTest/resources/jacoco-agent.properties
with the contents output=none
so jacoco can startup without failing, and coverage will be written as normal and transferred correctly later by the android gradle plugin coverage implementation.
I think it's safe to ignore that offline instrumentation warning, because the path should be something alike: executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec")
(on the PC - so there is no need to save it on the device and then pull the file).
On Android this will add the JaCoCo agent into the APK:
buildTypes {
debug {
testCoverageEnabled = true
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With