patman
patman

Reputation: 2838

Android-Studio databinding not working

I wanted to take a look into data binding for Android so it set up a small project. But i can't seem to get it working for Android Studio.

Basically the problem is it doesn't render my layouts in the Android Studio editor because it complains it cannot find the <Layout> and <data> classes. I could run the project though.

I followed the instructions mentioned in https://developer.android.com/tools/data-binding/guide.html. Although there are remarks about lacking Android Studio integration i couldn't find anything about not being able to view the Layout files, as it would be a major drawback.

I have setup

classpath 'com.android.databinding:dataBinder:1.0-rc1'

and

apply plugin: 'com.android.databinding'

compile 'com.android.support:appcompat-v7:21.0.3'

in the gradle files.

I also have the latest Android Studio installed and i already rebuild my project.

EDIT: I found https://code.google.com/p/android/issues/detail?id=176274 discussion. They are mentioning this issue to be fixed in AI-141.2006197 and i am running AI-141.2017176 which should be later and therefore containing this feature, right?

EDIT 2: Updated now and also tried with AI-141.2218876, still the same issue.

Upvotes: 2

Views: 1979

Answers (1)

Jacob Tabak
Jacob Tabak

Reputation: 8094

Make sure the <layout> tag is not capitalized in your XML file! I see that it is capitalized in your question. That won't work.

If this isn't the solution, please update our question to include the full activity and XML layout and stack trace of the build failure.

Upvotes: 3

Related Questions