Mockito 2 for Android Instrumentation test : Could not initialize plugin: interface org.mockito.plugins.MockMaker

Working with Android replace

androidTestImplementation "org.mockito:mockito-core:$mockito_core_version"
androidTestImplementation "org.mockito:mockito-inline:$mockito_core_version"

for

androidTestImplementation "org.mockito:mockito-android:$mockito_core_version"

My version was: $mockito_core_version = '2.28.2'


I've got similar problem. I my case that was invalid declaration in resource/mockito-extensions/org.mockito.plugins.MockMaker file. During some refactoring process IDE replaced correct value:

mock-maker-inline

with this one:

infrastructure-maker-inline 

I've noticed that accidental change while reviewing the commit diff because it didn't look suspicious for first look.


This helped me

androidTestImplementation("org.koin:koin-test:1.0.2")
{ exclude("org.mockito", "mockito-inline") }
androidTestImplementation("org.mockito:mockito-android:2.24.5")

Koin represents some library that contain org.mockito