5

Recently i have updated Android studio from 1.5.1 to 2.0, after updation it asked me to use latest gradle i.e. com.android.tools.build:gradle:2.0.0

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0'
    classpath "com.android.databinding:dataBinder:1.0-rc1"
}

But after updating it is showing error with DataBinding plugin.

apply plugin: 'com.android.databinding' //error on this line

Error message :

Error:(2, 0) Cause: org/apache/commons/lang3/StringUtils
Open File

I have not used any apache library or any deprected apache classes.

UPDATE :

Harshad's answer helped me, so final conclusion is we don't need to add those plugins with gradle 2.0.+

classpath "com.android.databinding:dataBinder:1.0-rc1" remove
apply plugin: 'com.android.databinding' remove

Ravi
  • 34,851
  • 21
  • 122
  • 183
  • see my answer if this helpful to you. –  Apr 08 '16 at 04:17
  • 2
    The Android Gradle Plugin already includes data binding since version 1.5.0. You don't need to use the extra Gradle Plugin anymore. You didn't have to do that for quite a long time now. You can activate databinding in your build.gradle simply by setting a flag, see @Harshads answer. – Xaver Kapeller Apr 08 '16 at 04:19
  • @XaverKapeller thanks for explaination, but recently i was using 1.5.0 and i have to add that plugin, i think after 2.0.0 we dont need to add those plugins additionaly. – Ravi Apr 08 '16 at 04:35

1 Answers1

7

This may be help you.

You can just remove these two lines of code:

apply plugin: 'com.android.databinding'

And this one in buildscript's dependencies:

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

Then add the dataBinding section to your build.gradle like this.

buildscript {
    ...
}

android {
    ...

    dataBinding {
        enabled = true
    }
    ...

}

dependencies {
    ...
}