Android Studio autocomplete shows same layout view ID twice

58 Views Asked by At

When using the autocompletion feature, I suddenly see every layout view ID twice. How can I only show each ID one time in the autocomplete popup?

Note, I am importing the activity_main.xml layout like this:

import kotlinx.android.synthetic.main.activity_main.*

Autocomplete two instances of each ID

1

There are 1 best solutions below

1
cactustictacs On

Maybe doing a Clean and Rebuild would help (in the Build menu), or Invalidate Caches and Restart in the File menu.

But just so you know, Kotlin Android Extensions (including the synthetics you're using) is deprecated and unsupported, so it's possible you might see screwy behaviour like this in the tooling. You might just have to put up with it if you continue to use it - the recommended replacement is View Binding, and there's some info about it here (and how to migrate from synthetics) here