Hi I’m trying to integrate facebook ads network vi...
# compose
r
Hi I’m trying to integrate facebook ads network via Admob mediation to my app But I’ve encountered an error while restoring view state when using
AndroidView(factory: ..)
inside Compose LazyList As a workaround I checked duplicate ids and reset them to random id Error message: IllegalArgumentException: Wrong state class, expecting View State but received class… This usually happens when two views of different type have the same id in the same hierarchy.
a
You should be able to use
View.generateViewId()
and not rely on random
i
View.generateViewId()
isn't stable across configuration changes (it is just a static, ever increasing counter that never gives you the same number back), so if you actually want your state restored correctly, you can't use that either
a
Yeah you would need to persist it; in a rememberSaveable or similar you'd avoid collisions
☝🏼 1
☝️ 3