3

I got this warning using mockito

You included the 'mockito-android' dependency in a non-Android environment. The Android mock maker was disabled. You should only include the latter in your 'androidTestCompile' configuration If disabling was a mistake, you can set the 'org.mockito.mock.android' property to 'true' to override this detection.

where could I set the property that the message say?

what is this error about?

Jose M Lechon
  • 5,766
  • 6
  • 44
  • 60

2 Answers2

5

It seems that for testImplementation we should use mockito-core and for androidTestImplementation mockito-android

Mockito Documentation

0

If you are using mockito-android as implementation(sample use case: if you are building a library for tests) then set the property as a System property inside your @Before method to let mockito know that the dependency is not added as implementation by mistake

 @Before
 open fun setUp() {
    System.setProperty("org.mockito.mock.android", "true")
 }
deepdroid
  • 633
  • 5
  • 26