Search code examples
androidgradleandroid-databinding

Android DataBinding build error


I have a problem with Data Binding library for Android. I have a freshly installed Android Studio v2.0 and newly created project. The problem is that when I try to add

dataBinding {
    enabled = true
}

to my build.gradle, I get this error while trying to build the project: :app:dataBindingProcessLayoutsDebug FAILED Error:Execution failed for task ':app:dataBindingProcessLayoutsDebug'.

Could not initialize class android.databinding.parser.XMLLexer

The build.gradle files look like this:

buildscript {
    repositories {
        jcenter()
    }
dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0'

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

and

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

defaultConfig {
    applicationId "com.silgrid.test"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dataBinding {
    enabled = true
}
}

dependencies {
}

Does anyone know how to fix this? Thanks.


Solution

  • For me it got fixed after updating to Android Studio 2.2