Data Binding does not work

2

I'm trying to use the Data Binding on Android.

For this I added the classpath in the application:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0-beta3'
        classpath 'com.android.databinding:dataBinder:1.0-rc4'
    }
}


apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'

But when I try to compile the following error occurs:

  

Error: Unable to find method   'android.databinding.tool.LayoutXmlProcessor (Ljava / lang / String; Landroid / databinding / tool / writer / JavaFileWriter; IZLandroid / databinding / tool / LayoutXmlProcessor $ OriginalFileLookup;)'.   Possible causes for this unexpected error include:

  • Gradle's   dependency cache may be corrupt (this sometimes occurs after a network   connection timeout.) Re-download dependencies   and sync project (requires network)
  • The state of a Gradle   build process (daemon) may be corrupt. Stopping all Gradle daemons may   solve this problem. Stop Gradle build   processes (requires restart)
  • Your project may be using a   third-party plugin which is not compatible with the other plugins in   the project or the version of Gradle requested by the   project.
In the case of corrupt Gradle processes, you can   also try closing the IDE and then killing all Java processes.

I do not know if it's really necessary to add this information, but when I try to compile just by enabling the databinding:

dataBinding {
        enabled true
    }

The following occurs:

  

Error: (23, 23) No resource type specified (at 'text' with value   '@ {user.name}').

Has anyone used this feature successfully?

    
asked by anonymous 20.04.2016 / 15:33

1 answer

1

Try this:

dataBinding {
    enabled = true
}

Place = after enabled

    
01.08.2016 / 15:04