2

I'm trying to update my app to the new android gradle plugin 3.0.0-alpha1. I've went through the migration guide at https://developer.android.com/studio/preview/features/new-android-plugin-migration.html and as far as I can tell everything is as it's suppose to be. I've tripled check this.

My project setup is quite simple I have a lib2 that depends on lib1. Everything runs smoothly until code coverage comes into play. All tests in lib1 run without a problem, but the tests in lib2 that hit code from lib1 throw the famous exception:

java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_773e439.Offline

All other tests from lib2 run without a single problem.

I've tried every solution I found on the web. From forcing the version of jacoco for both libs. Using the one that comes packaged with the android plugin. Using the standalone jacoco plugin. Excluding the problematic classes from code coverage. Moving the tests to a separate module, which produces a greater amount of failures with the given exception. It seems that every time a library depends on another, this fails.

The weirdest part is that unpacking the jacoco agent reveals that the class is actually there - for both libs.

Has anyone come across the issue and has a solution? Thank you

Fred
  • 16,367
  • 6
  • 50
  • 65
  • What an annoying error. 8 hours trying to find a solution. Hope to find and post it here soon. – Victor Oliveira Feb 22 '19 at 17:53
  • Possible duplicate of [java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal\_14f7ee5/Offline](https://stackoverflow.com/questions/39195754/java-lang-noclassdeffounderror-failed-resolution-of-lorg-jacoco-agent-rt-inter) – Mark Rotteveel Jun 16 '19 at 14:33
  • This is caused due to a bug on Jacoco version `0.7.6.201602180812`. Reference from another post: https://stackoverflow.com/questions/39195754/java-lang-noclassdeffounderror-failed-resolution-of-lorg-jacoco-agent-rt-inter/45947840 – Victor Oliveira Feb 22 '19 at 19:14

0 Answers0