cucumber / cucumber-android

Android support for Cucumber-JVM
MIT License
135 stars 62 forks source link

Failed resolution of: Lcucumber/runtime/ClassFinder when using cucumber-picocontainer > 4.8.1 #93

Closed josepmc closed 2 years ago

josepmc commented 2 years ago

Describe the bug The cukeulator example is tied to version 4.8.1 of the library cucumber-picocontainer (Jan 2020), whereas the latest as of today is 7.0.0. Setting the version of the dependency to anything newer than 4.x versions will cause the library to fail.

To Reproduce Steps to reproduce the behavior:

  1. Change the build.gradle to use androidTestImplementation "io.cucumber:cucumber-picocontainer:7.0.0"
  2. Try to run the tests (you'll need to comment TypeRegistryConfiguration first as it won't compile)

Expected behavior There will be an initialization error. On the latest version, you'll need to see the results in Logcat as Android Studio might not even pick them up.

StackTrace

java.lang.NoClassDefFoundError: Failed resolution of: Lcucumber/runtime/ClassFinder;
at io.cucumber.junit.CucumberJUnitRunnerBuilder.runnerForClass(CucumberJUnitRunnerBuilder.java:11)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at androidx.test.internal.runner.AndroidRunnerBuilder.runnerForClass(AndroidRunnerBuilder.java:147)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:73)
at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:105)
at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:804)
at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:613)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:411)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)
Caused by: java.lang.ClassNotFoundException: Didn't find class "cucumber.runtime.ClassFinder" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.swissborg.android.test-s3CV2XrqP01efq06SGN29Q==/base.apk", zip file "/data/app/com.swissborg.android.dev-tjgHoWrCZT9ar9XZBFnyyw==/base.apk"],nativeLibraryDirectories=[/data/app/com.swissborg.android.test-s3CV2XrqP01efq06SGN29Q==/lib/x86, /data/app/com.swissborg.android.dev-tjgHoWrCZT9ar9XZBFnyyw==/lib/x86, /data/app/com.swissborg.android.test-s3CV2XrqP01efq06SGN29Q==/base.apk!/lib/x86, /data/app/com.swissborg.android.dev-tjgHoWrCZT9ar9XZBFnyyw==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
lsuski commented 2 years ago

As cucumber-android uses cucumber-java/junit 4.8.1 you have to use all cucumber-* (except cucumber-android which is in 4.9.0) libs in that version. If you mix runtime dependencies version you will have runtime crashes with such errors.