Search code examples
androidandroid-databindingandroid-studio-2.0android-gradle-2.0

issue with gradle 2.0.0 and DataBinding


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


Solution

  • 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 {
        ...
    }