Question

I use easymock-3.2.jar in my android test project. I find it in its Home:

2013-07-11: EasyMock 3.2 is available. Add @Mock annotations and Android support.

However , I got exception when I use it.

java.lang.NoClassDefFoundError: org.easymock.EasyMock

I googled a lot , and add

dexmaker-1.0.jar
objenesis-1.2.jar
cglib-nodep-2.2.2.jar or cglib-2.2.jar

But the exception still be there.Who can help me? Thanks a lot.

Was it helpful?

Solution

Put the library

easymock-3.2.jar
dexmaker-1.0.jar
dexmaker-mockito-1.0.jar

in tests/libs. And it will work.

Be careful , it's in tests/libs , not in tests/lib. It will throw

java.lang.NoClassDefFoundError: org.easymock.EasyMock

if you position them in tests/lib.

OTHER TIPS

The first step is to get EasyMock. You can get the latest version from Easymock’s download page. Choose the latest version and you will get a zip file. You only need easymock-3.2.jar (3.2 will change depending on the version you choose). You will also need dexmaker for Easymock to work on Android. You can get the jar from Dexmaker’s website. Once you have both jar files put them in /tests/libs. Now you have EasyMock available in your tests.

for more detail follow below link http://ncona.com/2013/11/writing-unit-test-for-android-with-easymock/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top