How to import AndroidViewBinding in jetpack compose
Asked Answered
L

1

6

I'm trying to use some fragments within jetpack compose but I can not import AndroidViewBinding from (androidx.compose.ui.viewinterop) and it is always appearing as an unresolved name

how to import it ??

Laureen answered 22/12, 2022 at 7:37 Comment(1)
Did you check this link developer.android.com/jetpack/compose/interop/… ?Herrah
S
18

I just came against the same problem - unresolved. Turns out, we need to import:

implementation "androidx.compose.ui:ui-viewbinding:$compose_uiversion"

See here for more info - (latest stable version is 1.3.2)

Just another example where I wish they really made their documentation explicit about dependencies. This official documentation doesn't help.

Saxton answered 2/1, 2023 at 2:11 Comment(1)
Even after adding the dependency the import import androidx.compose.ui.viewinterop.AndroidViewBinding does not resolve for me. What is interesting is that in my scenario i can navigate to the androidx.compose.ui.viewinterop package that is under androidx.compose.ui.ui-android but there is no AndroidViewBinding there. By exploring my dependencies i found that the needed class is under androidx.compose.ui.ui-viewbinding but the import statement does not resolve possibly to a conflict. Anyone had a simiar scenario?Icebreaker

© 2022 - 2024 — McMap. All rights reserved.