I recently upgraded my Android Studio to 4.2.1 and I noticed that most of my tests (both Unit and AndroidTest) now fail with this error
Failed to load interface org.mockito.plugins.MockMaker implementation declared in java.lang.CompoundEnumeration@1570cad0
Caused by: java.lang.ClassCastException: Cannot cast org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker to org.mockito.plugins.MockMaker
java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
My configuration in the build.gradle file is the following
testImplementation "org.mockito:mockito-inline:2.28.2"
testImplementation "org.robolectric:robolectric:3.8"
androidTestImplementation "org.mockito:mockito-android:2.28.2"
And if I launch the tests on my personal laptop (not the work one) where I am still on AS 4.1.2 then all runs smoothly. It seems to be related to Robolectric but I have not been able to find the culprit, does anyone have any idea what changed and how to solve it?