Android Data Binding build.gradle syncing prob?

To bind data

1) I added

android {
    dataBinding {
        enabled = true
    }

for 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"(for the project build.gradle)

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

But the same error occurred.

+4
source share
2 answers

Add a dependency in the build.gradle file of the project

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 module’s build.gradle file, the DataBinding section is included:

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

Build.gradle versions can be found here: Versions

+6
source

The "exampleDatabinding" project may use a version of Gradle that does not contain a method.

Gradle 2.10 Gradle, . YourProject → gradle → → gradle -wrapper.properties

Url = https://services.gradle.org/distributions/ gradle -2.10-all.

dataBinding:

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

:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'

    }
}
+1

Source: https://habr.com/ru/post/1614704/


All Articles