我收到以下错误
错误:(3, 0) 原因:org/apache/commons/lang3/StringUtils
当我尝试在我的 Android 项目中添加数据绑定时。
我的依赖项包括:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha7'
classpath 'me.tatarka:gradle-retrolambda:3.2.2'
classpath 'com.android.databinding:dataBinder:1.0-rc1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的 gradle 包装器是: distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip
我的 gradle 文件:
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.android.databinding'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.quizviz.workbook.myworkbook"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-jackson:2.0.0-beta3'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta3'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.0.1'
}
我花了一段时间才注意到这个问题是由谷歌更新使用数据绑定库的方式引起的。您可以从这里查看更多信息:http://developer.android.com/tools/data-binding/guide.html http://developer.android.com/tools/data-binding/guide.html.
您只需删除这两行代码即可:
apply plugin: 'com.android.databinding'
这在 buildscript 的依赖项中:
classpath 'com.android.databinding:dataBinder:1.0-rc1'
然后将 dataBinding 部分添加到您的 build.gradle 中,如下所示。
buildscript {
...
}
android {
...
dataBinding {
enabled = true
}
...
}
dependencies {
...
}
干得好。这对我有用:)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)