rekire
rekire

Reputation: 47965

No resource type specified (at 'text' with value '@={bindingVariable.propertyName}')

I have get a strange error while using the data binding API:

No resource type specified (at 'text' with value '@={bindingVariable.propertyName}').

Here is my xml:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools">
    <data>
        <variable
            name="address"
            type="com.example.Address"/>
    </data>

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

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/edit_hint_street"
            android:text="@={address.street}"
            tools:text="Evergreen terrace 742"/>
    </android.support.design.widget.TextInputLayout>
</layout>

This is my POJO class:

public class Address {
    private String street;

    public void setStreet(String street) {
        this.street = street;
    }

    public String getStreet() {
        return street;
    }
}

Upvotes: 2

Views: 3042

Answers (1)

rekire
rekire

Reputation: 47965

Well after checking twice my build.gradle I found the bug: I forgot the enable the data binding API like this:

dataBinding {
    enabled = true
}

That has to be in your android DSL.

Upvotes: 8

Related Questions