Following an upgrade of android-studio, kotlin plugins and sourceCompatibility to Java 8 in an android project, many layout ids are not any more recognized (but strangely not all). It looks like field name with underscores are not recognized in binding.
For instance: whith the following declaration in the layout
<TextView
android:id="@+id/alert_hist_item__equipement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:text="@string/Device"
android:textStyle="bold"
/>
in the code
alert_hist_item__equipement.text = "x"
is not recognized but
alertHistItemEquipement.text = "x"
is recognized.
If I change the field names in the layouts to equivalent camel case names (either only in the code, with the names in the layout still having underscores; or both in code and layout) the fields are recognized.
It is so painful for many reasons:
- I have dozens of layouts all with id names containing underscore
- I find names with underscore easier to read (and my team too)
- it was never specified that android:id fields should follow certain rules
is this possible to change that behavior ? Could it be a bug ?