Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio 3.0 got Error SHA-256 digest error for org/jacoco/agent/rt/RT.class

Tags:

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

I got the error like this:

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

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
}

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?

Thanks

like image 339
Watcharin.s Avatar asked Oct 31 '17 10:10

Watcharin.s


1 Answers

UPDATE 2:

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.

UPDATE 1:

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.

Original post:

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.

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.

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
}
like image 141
J. Williams Avatar answered Sep 21 '22 12:09

J. Williams