Android does not recognize Mockito NoClassDefFoundError


I'm trying to use Mockito to run tests on an Android app. I copied the following jars for the project: Mockito-all-1.9.5.jar, dexmaker-1.0.jar, dexmaker-Mockito-1.0.jar. Then I added it to BuildPath. It does not generate compile error, but when I run the tests, the following error appears:

    java.lang.NoClassDefFoundError: org.mockito.Mockito
at com.example.projetomockito.test.ClienteTest.testExisteCliente(
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(
at android.test.InstrumentationTestCase.runTest(
at android.test.AndroidTestRunner.runTest(
at android.test.AndroidTestRunner.runTest(
at android.test.InstrumentationTestRunner.onStart(

The error appears in the following line:

cliente = mock(Cliente.class);
asked by anonymous 16.08.2015 / 23:30

0 answers