Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Data Binding build.gradle syncing prob?

For databinding

1) I have added

android {
    dataBinding {
        enabled = true
    }

to my project build.gradle, but this error occurs:

Error:(5, 0) Gradle DSL method not found: 'dataBinding()'
Possible causes:

.The project 'exampleDatabinding' may be using a version of Gradle that does    
not contain the method.
Gradle settings

.The build file may be missing a Gradle plugin.

Apply Gradle plugin

2) Then I added:

apply plugin: "com.android.databinding" (to project build.gradle)

and classpath "com.android.databinding:dataBinder:1.0-rc1" (to project build.gradle)

But the same error occured.

like image 580
Sourabh Bissa Avatar asked Mar 14 '23 06:03

Sourabh Bissa


1 Answers

In the file build.gradle of the project add the dependency

dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0-beta2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

And in the file build.gradle of the module include the dataBinding section:

android{
  ...
  dataBinding {
        enabled = true
    }
  ...
}

The versions of build.gradle can be found here: Versions

like image 85
Jonnathan Avatar answered Mar 23 '23 09:03

Jonnathan