Android Databinding xml duplicate attribute

Make sure that xmlns:android isn't automatically added to both <layout> and your actual layout ViewGroup:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        ...>
    </android.support.v4.widget.DrawerLayout>
</layout>

Remove xmlns:android from either place.


I've just found out what the solution is. I just had to delete layout_width and layout_height from the <layout> definition.

<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="layout.tests">

instead of

<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="layout.tests">