Skip to content Skip to sidebar Skip to footer

Android Testing Java.lang.noclassdeffounderror Error Due To Fest-android

I'm currently implementing Fest for Android into my project but I seem to be running into a dependency issue. If I run my tests without the Fest library included, the tests will ru

Solution 1:

You have two problems here:

  1. You are compiling two versions of robotium into your project, so you can remove one of them.

  2. FEST-Android already has a dependency of support-v4 library so you will need to exclude that just like you are excluding 'hamcrest-core' from the 'dexmaker-mockito' dependency. You can see all of its dependencies from FEST-Android Dependencies.

I would recommend that you make the following changes to your dependencies.

// Testing LibrariesandroidTestCompile('com.squareup:fest-android:1.0.8') {
    exclude module: 'support-v4'
}
androidTestCompile('com.google.code.gson:gson:2.2.4')
androidTestCompile('com.jayway.android.robotium:robotium-solo:5.1')
androidTestCompile('com.google.mockwebserver:mockwebserver:20130706')
androidTestCompile('com.google.dexmaker:dexmaker:1.0')
androidTestCompile('com.google.dexmaker:dexmaker-mockito:1.0') {
    exclude module: 'hamcrest-core'
    exclude module: 'objenesis'
    exclude module: 'mockito-core'
}
androidTestCompile('org.mockito:mockito-all:+')

As you can see I have removed the extra robotium dependency that you had and I have also excluded the module 'support-v4'. Hopefully this should have you back running tests in no time! :-D

Post a Comment for "Android Testing Java.lang.noclassdeffounderror Error Due To Fest-android"