Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

More than one file was found with OS independent path 'mockito-extensions/org.mockito.plugins.MockMaker'

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

like image 668
Joyal C Joseph Avatar asked Dec 07 '18 10:12

Joyal C Joseph


2 Answers

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.

like image 62
aha Avatar answered Oct 19 '22 17:10

aha


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.

like image 2
Zain Avatar answered Oct 19 '22 17:10

Zain