gradle 2.0.0和DataBinding的问题 [英] issue with gradle 2.0.0 and DataBinding

查看:126
本文介绍了gradle 2.0.0和DataBinding的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我已将Android Studio从1.5.1更新到2.0,更新后要求我使用最新的gradle,即com.android.tools.build:gradle:2.0.0

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"
}

但是更新后,DataBinding插件显示错误.

But after updating it is showing error with DataBinding plugin.

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

错误消息:

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

我没有使用过任何apache库或任何不受欢迎的apache类.

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

更新:

UPDATE :

Harshad的回答对我有所帮助,所以最后的结论是我们不需要使用gradle 2.0.+

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" 删除
apply plugin: 'com.android.databinding' 删除

推荐答案

这可能会对您有所帮助.

This may be help you.

您只需删除以下两行代码:

You can just remove these two lines of code:

apply plugin: 'com.android.databinding'

这与buildscript的依赖项有关:

And this one in buildscript's dependencies:

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

然后将dataBinding部分添加到build.gradle中,如下所示.

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

buildscript {
    ...
}

android {
    ...

    dataBinding {
        enabled = true
    }
    ...

}

dependencies {
    ...
}

这篇关于gradle 2.0.0和DataBinding的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆