After migrating to AndroidX I found that in some, not all of my classes the kotlinx.android.synthetic
fields are now failing to convert to the actual class.
Widget has an unresolved type 'androidx.core.widget.DrawerLayout', and thus it was upcasted to 'android.view.View'
Is kotlinx.android.synthetic
currently incompatible with AndroidX?
Synthetic properties to access views were created as a way to eliminate the common boilerplate of findViewById calls. These synthetics are provided by JetBrains in the Kotlin Android Extensions Gradle plugin (not to be confused with Android KTX).
Kotlin Android Extensions is deprecated, which means that using Kotlin synthetics for view binding is no longer supported.
findViewById. Recently Android has announced that with Kotlin 1.4. 20, their Android Kotlin Extensions Gradle plugin will be deprecated and will no longer be shipped in the future Kotlin releases.
I'm using androidx
with kotlinx.android.synthetic
and a drawer layout with no issues. I believe the drawer layout tag should be androidx.drawerlayout.widget.DrawerLayout
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With