jraska/Falcon

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/spoon/SpoonRule

kocel opened this issue · 4 comments

kocel commented

Hi,
I'm trying to use FalconSpoon in my espresso tests, but I keep getting java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/spoon/SpoonRule
That's what I have is buld.gradle:

implementation 'com.jraska:falcon:2.0.1'
implementation 'com.jraska:falcon-spoon-compat:2.0.1'
androidTestImplementation 'com.jraska:falcon:2.0.1'
androidTestImplementation 'com.jraska:falcon-spoon-compat:2.0.1'

I also tried to add dependency to spoon itself, but it doesn't help. I'm able to use Falcon methods, only FalconSpoonRule is a problem.
Gradle build is successful, error appears in runtime (tests are written in Kotlin)
I disabled proguard for this build.
Any suggestions?

Hello, thanks for using the library.

From the first look it does not seem right to me that you have both dependencies as implementation and androidTestImplementation. If you are using it in main app it should be only implementation, if only in UI tests then it should be only androidTestImplementation only. Same for the Spoon dependency.

I can also see there is 'com.android.support.test:rules:1.0.1' dependency which is not shared by the falcon-spoon-compat artifact.

Please try to remove the implementation clauses and use only androidTestImplementation and let me know if it helps.

kocel commented

Yeah, I know, I just wanted to show that I tried in both scopes. Error occurs when both dependencies are only in androidTestImplementation (I mean it occurs always, also when both are in androidTestImplementation). I just added 'com.android.support.test:rules:1.0.1' (tried in both scopes) but still the same. What else can I try?

Hello again, I tried and works fine for me once I added

repositories {
  maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

to build.gradle and when i added:

androidTestImplementation 'com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT'
kocel commented

That worked, thanks a lot!