Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: org.mockito.Mockito

I'm trying to run unit test on Android Library project and using mockito 1.9.5 with dexmaker 1.0 & dexmaker -mockito-1.0 jar files.

I am using Android Studio 0.2.6 and whenever I run a test case I end up getting

java.lang.NoClassDefFoundError: org.mockito.Mockito exception.

I have mentioned the dependencies in build.gradle file as below

compile 'com.google.dexmaker:dexmaker-mockito:1.0'
compile 'com.google.dexmaker:dexmaker:1.0'
compile 'org.mockito:mockito-core:1.9.5'

Has anyone encountered this problem before on Android Studio? If you did please share your solutions/fixes.

Thanks

like image 428
Prasanna Avatar asked Sep 03 '25 04:09

Prasanna


1 Answers

Cleaning the project from a terminal gradlew clean fixed it for me.

like image 192
Saimon Avatar answered Sep 07 '25 00:09

Saimon