Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm not able to setup my project to use Android Data Binding. This is my build.gradle:

apply plugin: 'com.android.databinding'


buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0-beta2'
        classpath "com.android.databinding:dataBinder:1.0-rc4"
    }
}

android {
    ...
    dataBinding {
        enabled = true
    }

    compileSdkVersion 21
    buildToolsVersion "20.0.0"
    ...
}

When I build, I get this error:

[data binding plugin]: failed to setup data binding

java.lang.NoSuchMethodError: android.databinding.tool.LayoutXmlProcessor.(Ljava/lang/String;Ljava/util/List;Landroid/databinding/tool/writer/JavaFileWriter;IZ)V

EDIT

I have modified build.gradle:

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

But I still get the same error. Also I have this apt config:

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
    }
}

Since I'm using AndroidAnnotations.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
805 views
Welcome To Ask or Share your Answers For Others

1 Answer

You should now set it up with 1.5.0 and without the explicit data binding import:

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

Android Data Binding 1.0 was released as part of the Android gradle plugin.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...