android include tag - invalid layout reference android include tag - invalid layout reference xml xml

android include tag - invalid layout reference


If anyone stumbles upon this thread looking for this error:

Caused by: android.view.InflateException: You must specifiy a layout in the include tag: <include layout="@layout/layoutID" />

Make sure you do:

<include layout="@layout/your_layout" />

and not:

<include android:layout="@layout/your_layout" />

layout should not have android: in front of it.


I think i should mention how i solved the same problem. Tried cleaning the project and didn't work. I have quite large names for the layout (chrono_first_small_field), and that wasn't the cause either.

Closed Eclipse, and just opened it again, and that worked.

That makes more sense than having to implement the onMeasure method :-)


I don't see anything immediately wrong with that, so that's a bit odd. I can only think of two things: 1) Have you tried using a shorter file name? There are a few restrictions on what's acceptable in a file name, e.g. no uppercase characters or symbols, in order to ensure compatibility and file name length might be one of them. 2) Have you tried removing some of your android:... statements in the include, and leaving it at just <include layout="@layout/..."/>? You don't actually need to specify its height and width in the include as that's already defined in the imported layout file.