sergio-sastre / ComposablePreviewScanner

A library to help auto-generate screenshot tests from Composable Previews with any screenshot testing library: JVM-based (i.e. Paparazzi, Roborazzi) as well as Instrumentation-based (i.e. Shot, Dropshots, Android-Testify, etc.)
MIT License
121 stars 1 forks source link

java.lang.NoSuchMethodError: 'void sergio.sastre.composable.preview.scanner.core.preview.ComposablePreview.invoke(androidx.compose.runtime.Composer, int)' #1

Closed sergio-sastre closed 1 month ago

sergio-sastre commented 1 month ago

In a Parameterized Screenshot Tests, where AndroidComposablePrevieScanner or JvmAnnotationScanner are used, when calling the preview, it throws an exception.

This is probably because the :core is a kotlin library missing the compose runtime

As a workaround, one can copy :core and either :android or :jvm classes in the module where AndroidComposablePrevieScanner or JvmAnnotationScanner are supposed to be used, as well as the classgraph and reflect dependency, and that should work.

    testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.9.22'
    testImplementation 'io.github.classgraph:classgraph:4.8.172'
sergio-sastre commented 1 month ago

Fixed in 0.1.1