Error:(3, 0) Cause: org/apache/commons/lang3/StringUtils
Asked Answered
M

1

5

I get the following error

Error:(3, 0) Cause: org/apache/commons/lang3/StringUtils

when I try to add data binding in my Android project.

My dependencies include :

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

My gradle wrapper is : distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip

My gradle file :

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'

}
Matelda answered 7/2, 2016 at 7:33 Comment(5)
you have to add it in your app gradle file not project gradle.Blue
could you be more specific ? I have added dependencies in project gradle and plugin in app gradleMatelda
there are two gradle files in android studio. If you open project view from side panel in studio, you will see first build.gradle, and when navigate inside app folder there will be one more build.gradle. You should add your dependencies in this gradle fileBlue
You don't need this: classpath 'com.android.databinding:dataBinder:1.0-rc1' -- that version is very old. I don't know if that is the problem, though. Also, you don't need the apply plugin: 'com.android.databinding'Tannenberg
Can you post the solution please?Waldon
L
24

It took me a while to notice this problem is caused by google updating the way to use data binding library. You can see more information from here: http://developer.android.com/tools/data-binding/guide.html.

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

Here you go. This works for me :).

Legislate answered 24/2, 2016 at 6:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.