issue with gradle 2.0.0 and DataBinding

不羁岁月 提交于 2020-01-02 05:25:30

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/36491390/issue-with-gradle-2-0-0-and-databinding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!