More than one file was found with OS independent path 'mockito-extensions/org.mockito.plugins.MockMaker'
getting this error while adding
androidTestImplementation "org.mockito:mockito-inline:2.15.0"
in gradle to mock final class
For Android, you usually just want
androidTestImplementation "org.mockito:mockito-android:<latest-version>"
You especially don't want mockito-inline
because it configures the wrong MockMaker
(mock-maker-inline
) instead of AndroidByteBuddyMockMaker
which is the only one working on Android that is distributed by the Mockito project. If you need advanced capabilities or faster mocking, head over to the dexmaker project.
In my case I resolved this issue by removing dexmaker
dependency from the build.gradle
So, I removed the below dependency
androidTestImplementation "com.linkedin.dexmaker:dexmaker-mockito:2.12.1"
and kept only the below Mockito
dependency
androidTestImplementation "org.mockito:mockito-android:2.25.0"
Not sure if that your case, but it solves mine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With