【问题标题】:java.io.FileNotFoundException: /jacoco.exec: open failed: EROFS (Read-only file system)java.io.FileNotFoundException:/jacoco.exec:打开失败:EROFS(只读文件系统)
【发布时间】:2019-09-30 14:31:21
【问题描述】:

在尝试实施 JaCoCo 离线检测时遇到此问题。

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)

【问题讨论】:

    标签: android jacoco


    【解决方案1】:

    我认为忽略离线检测警告是安全的,因为路径应该是类似的:executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec")(在 PC 上 - 因此无需将其保存在设备上然后提取文件)。


    在 Android 上,这会将 JaCoCo 代理添加到 APK 中:

    buildTypes {
        debug {
            testCoverageEnabled = true
        }
    }
    

    【讨论】:

    • 应该将 jacoco-agent.properties 放在 android 应用程序的什么位置?
    【解决方案2】:

    解决方案在 jacoco 中有详细记录,但对于 Android 用户,您需要在 /src/androidTest/resources/jacoco-agent.properties 中添加文件,内容为 output=none,以便 jacoco 可以正常启动,并且覆盖范围将正常写入并传输稍后通过 android gradle 插件覆盖实现正确。

    【讨论】:

    • 对我没有帮助,但使用路径“src/debug/resources/jacoco-agent.properties”它可以工作
    猜你喜欢
    • 2015-01-22
    • 2014-04-19
    • 2012-12-08
    • 2015-01-02
    • 2014-06-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-23
    • 2015-06-08
    相关资源
    最近更新 更多