0

Why BR class (Android data-binding auto generated class for bindable fields) in android does not auto import like another classes, alt + enter does not work for this class?

When i write notifyPropertyChanged(BR.someField); for any field, i have to manually import that class with full package name.

Note All other classes can be imported automatically but only this BR class is not importing.

Even if turned on file --> setting --> auto-import --> check all options

Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212
  • try this @khemraj https://stackoverflow.com/questions/36144299/what-is-the-way-to-enable-the-auto-import-in-android-studio-windows – Chirag Talsaniya May 21 '18 at 09:44
  • Not useful for me – Khemraj Sharma May 21 '18 at 09:55
  • I've seen two causes for this. First, resources need to be compiled before BR class is available. So, if there are errors in the resources or you recently made a change and it is not compiled, the class won't be available for import. Second, BR can exist in multiple packages. The ambiguity seems to confuse it but can sometimes work around by explicitly typing the full path (e.g. `com.mypackage.BR`). – Alan Todtenkopf May 21 '18 at 16:05
  • Yes it works with typing full path, but it should behave like other classes, just type BR and import by alt + enter. Lets see android improve it. – Khemraj Sharma May 21 '18 at 16:16

0 Answers0