6

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?

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
Anthony
  • 7,638
  • 3
  • 38
  • 71

1 Answers1

10

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.

tgrable
  • 1,013
  • 1
  • 7
  • 15
  • 1
    Yup, just realized that's the delta. Some of the layout files migrated in the studio conversion. Some didn't. `Migrate to AndroidX` arguably shouldn't have been released in it's current state. I ended up going file by file anyway and it only created an illusion that it helped. – Anthony Aug 29 '18 at 14:48
  • To make it worse, in my case, the `DrawerLayout` was actually converted in the layout, but random other ones were not, causing the layout to ostensibly look converted at the top. – Anthony Aug 29 '18 at 14:51
  • Yeah, I ran into basically the same thing when I updated an app last week. – tgrable Aug 29 '18 at 14:55