Synthetic view properties don't work from layout files in library

I have a project that has a library module with Fragments and corresponding layouts. The main app code extends these Fragments, but trying to access the synthetic layout properties fails unless the layout files are copied into the app res/layout directory. In the IDE it appears to work, and will auto-fill the correct import when a layout property is accessed, but at compile time it fails with errors like:

e: /Users/.../android/app/src/main/java/com/controlj/monitor/BluetoothFragment.kt: (15, 39): Unresolved reference: bluetooth_list

where bluetooth_list should be associated with the layout file bluetooth_list.xml. If this file is copied from the library res/layout to the app res/layout the error goes away. I’ve tried with plugin v 1.1.60 and 1.2.20 with no difference. I have the experimental extensions turned on.

3 Likes

Any update on this? @clydeps, have you figured out any solution for this?

No solution, other than copying the layout files into the app module.