本文介绍了Android Studio 3.0的org/jacoco/agent/rt/RT.class出现错误SHA-256摘要错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Android Studio更新到3.0并按照以下指令

After I update Android studio to 3.0 and migrated my project by following this instruction

我收到了这样的错误:

* What went wrong:
Execution failed for task
':app:transformClassesWithFirebasePerformancePluginForDevDebug'.
> SHA-256 digest error for org/jacoco/agent/rt/RT.class

我跟踪发现根本原因来自build.gradle文件中的这段代码.

I tracked and found that the root cause came from this code in build.gradle file.

debug {
    ...
    // Run code coverage reports by default on debug builds.
    testCoverageEnabled = true
}

因为当我评论这行代码时,项目构建良好.使用Android Studio 2.3时,我没有遇到这个问题.

Because when I commented this line of code the project built fine. I haven't got this problem when I used Android Studio 2.3.

我搜索了一些相关主题,发现有人说禁用即时运行可以解决问题,但不幸的是,对于我的情况不起作用.

I had searched some related topics and found that somebody said disable instant run will solve but unfortunately in not work for my case.

有人建议解决这个问题吗?

Dose anyone has any suggestion to solve this issue?

谢谢

推荐答案

更新2 :

Firebase支持人员仍然说该修补程序尚未推出,但我今天使用最新版本的firebase-perfjacoco对其进行了尝试,并且可以正常工作.

Firebase Support still says the fix is not rolled out, but I tried it out today with the latest versions of firebase-perf and jacoco and it works.

更新1 :

firebase-perf不适用于jacoco 已启用. Firebase支持团队能够复制此文件并正在调查.

firebase-perf doesn't work with jacoco when Java 1.8 support is enabled. Firebase support team was able to replicate this and is investigating.

原始帖子:

启用firebase-perf插件后似乎会触发此事件.我向Firebase团队提交了一个错误,如果得到答案,它将进行更新.

This looks to be triggered when firebase-perf plugin is enabled. I filed a bug with Firebase team and will update if I get an answer.

作为临时解决方法,仅注释掉apply plugin ... firebase-perf应该会有所帮助.它将禁用自动跟踪,但@AddTracenewTrace仍然可以使用

As a temporary workaround, just commenting out apply plugin ... firebase-perf should help. It will disable Automatic Traces but @AddTrace and newTrace should still work.

在我的情况下,testCoverageEnabled是根据项目属性有条件设置的,并且在评估覆盖率时不需要firebase-perf插件,因此我只是禁用了该插件:

In my case testCoverageEnabled is set conditionally based on a project property and I didn't need firebase-perf plugin for when evaluating the coverage, so I just disabled the plugin:

if (!project.hasProperty('coverageRun')) {
    apply plugin: 'com.google.firebase.firebase-perf'
}
// < ... >
if (project.hasProperty('coverageRun')) {
    testCoverageEnabled true
}

这篇关于Android Studio 3.0的org/jacoco/agent/rt/RT.class出现错误SHA-256摘要错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 20:47
查看更多