I have an Android test project in which I test my main application. The tests for my provider work correctly. However, the tests that extend ActivityInstrumentationTestCase2 fail with NoClassDefFoundError. The tests are very basic but it seems they fail in the constructor because they can’t find the activity (although the package where it looks is OK).
I have similar test projects for other apps that work flawlessly. The only difference I see is that in this particular project I use android-support-v4.jar and I think this is where the problem lies. However, I haven’t managed to fix it. Any ideas?
This post, that was updated to include
android-support-v4.jarcase, will help you:http://dtmilano.blogspot.com/2009/12/android-testing-external-libraries.html