Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

databinding must include a layout file

I have following very simple layout and wanted to switch to using data binding. Now I'm getting following error in my controller_main.xml:

Error:Execution failed for task ':app:dataBindingProcessLayoutsDebug_pro'.

****/ data binding error ****msg:[44 68 44 68 25] must include a layout file:...\app\src\main\res\layout\controller_main.xml ****\ data binding error ****

Any ideas? The error says, the resource android:layout id in the include tag is missing (that's my interpretation of the error), but that's not true. Commenting out the include tag removes the error.

Does anyone see the problem?

controller_main.xml

<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto" >

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/coordinatorLayout"
        android:fitsSystemWindows="true"
        android:background="?attr/main_background_color"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <RelativeLayout
            android:id="@+id/rlContent"
            android:fitsSystemWindows="true"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </RelativeLayout>

        <include
            android:layout_width="fill_parent"
            android:layout_height="@dimen/tool_bar_top_padding"
            android:id="@+id/stub_view_main_header_fixed"
            android:layout="@layout/view_main_header_fixed"
            app:elevation="0dp"/>

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

        </android.support.design.widget.AppBarLayout>

    </android.support.design.widget.CoordinatorLayout>

</layout>

view_main_header_fixed.xml

<?xml version="1.0" encoding="utf-8"?>
<View
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/vStatusbarBackground"
    android:layout_width="match_parent"
    android:layout_height="@dimen/tool_bar_top_padding" />
like image 776
prom85 Avatar asked Sep 12 '16 07:09

prom85


1 Answers

You should use layout instead of android:layout:

<include
        android:layout_width="fill_parent"
        android:layout_height="@dimen/tool_bar_top_padding"
        android:id="@+id/stub_view_main_header_fixed"
        layout="@layout/view_main_header_fixed"
        app:elevation="0dp"/>
like image 143
George Mount Avatar answered Nov 06 '22 03:11

George Mount