Using Mockito on Android

Mockito is a "Tasty mocking framework for unit tests in Java". It's quite popular, in fact at one point, it was measured as the Number 4 of Top 10 Java Libraries by usage on GitHub. See for more.

All you need to use Mockito in your Android tests is to add Mockito and dexmaker to your Gradle build. Dexmaker is a Java API for code generation on the Dalvik VM. It is also reported to work on Art (Android Runtime), see here.

Keep an eye out for Mockito 2.0, a major version bump due by end of March '15, watch the issue on GitHub.

EDIT: Look, if you find yourself needing Mockito for Instrumentation Tests, then you're probably doing it (testing) the wrong way. If you're using the new Unit Test capabilities of the Android tools, then you won't need Dexmaker. You should have everything you need to test with JUnit4 and Mockito. If you can't test your code, then refactor it.