cashapp / paparazzi

Render your Android screens without a physical device or emulator
https://cashapp.github.io/paparazzi/
Apache License 2.0
2.31k stars 215 forks source link

Error inflating view that uses DataBinding #1016

Open danielgomesoliveira opened 1 year ago

danielgomesoliveira commented 1 year ago

Description I've been trying to write a simple test for a view that uses data binding (root is layout), but I keep getting the error

Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class layout
Caused by: java.lang.ClassNotFoundException: onCreateView
...
Caused by: java.lang.ClassNotFoundException: layout

On the project sample I can see examples using View Binding, but not Data Binding.

Steps to Reproduce Try to inflate a view with Data Binding

@Test
fun testDefaultBinding() { 
    val view = FragmentBinding.inflate(paparazzi.layoutInflater)
    paparazzi.snapshot(view.root)
}

Expected behavior Test runs normally

Additional information:

Screenshots N\A

jrodbx commented 1 year ago

@danielgomesoliveira I know you provided the repro steps above (thank you!), but would you mind providing a link to a project repo with data binding enabled?

danielgomesoliveira commented 1 year ago

@jrodbx thank you for the quick answer. I prepared a small repo where this can be reproduced here.

Let me know if you need any other information