1

I have been trying for hours now to enable data binding in Android. Here is my gradle:

buildscript {
    repositories {
        mavenCentral()
        maven { url 'http://download.crashlytics.com/maven' }
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
    }

    dependencies {
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
        classpath 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'


        classpath "com.android.databinding:dataBinder:1.0-rc0"
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

repositories {
    maven { url 'http://download.crashlytics.com/maven' }
    maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}

android {
    compileSdkVersion 16
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "ts.kiosk.app.checkout"
        minSdkVersion 16
        targetSdkVersion 16
        versionCode 2
        versionName "0.0.2.258"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        abortOnError false
    }


    sourceSets {
        main {
            assets.srcDirs = ['src/main/assets', 'src/main/assets/']
        }
    }

    sourceSets {
        androidTest.setRoot('src/test')
    }

    dataBinding {
        enabled = true
    }
}



dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.crashlytics.android:crashlytics:1.+'
    compile 'net.danlew:android.joda:2.7.2'
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'
    compile 'com.squareup.retrofit:retrofit:1.6.1'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
    compile 'com.squareup.okhttp:okhttp:2.0.0'

    compile project(':asterixmodule')
    compile project(':servicemodule')
    compile project(':sdfclient')

    // Robolectric
    testCompile 'junit:junit:4.12'
    testCompile 'org.hamcrest:hamcrest-library:1.3'
    testCompile 'org.apache.maven:maven-ant-tasks:2.1.3' // fixes issue on linux/mac
    testCompile 'org.robolectric:robolectric:3.0'
}

I keep getting the error:

Error:Could not find com.android.databindig:databinder:1.0.-rc1   . 

I have also read similar posts on SO stating that you also have to add:

classpath 'com.android.tools.build:gradle:1.3.0-beta1'

but my gradle is 2.4 so I'm thinking I don't need that and of course if I do add that statement, gradle cannot find that version of gradle (1.3.0)

3 Answers 3

1

I upgraded to version 2.0 of Android Studio and the gradle build issue went away

Sign up to request clarification or add additional context in comments.

Comments

0

remove

classpath "com.android.databinding:dataBinder:1.0-rc0"

Starting with android gradle plugin 1.5.0, all you need is

android { dataBinding.enabled = true }

3 Comments

Yeah I had tried that too and I get: Error:(63, 0) Gradle DSL method not found: 'dataBinding()' Possible causes:<ul><li>The project 'Checkout' may be using a version of Gradle that does not contain the method. <a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin. <a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
does not sound like you are using android gradle plugin 1.5
Yep you are right, I was not. Thanks for pointing me in right direction. Now I have another data binding build issue: stackoverflow.com/questions/36582464/…
0

check your gradle version, i resolved it by upgrading :

previously :

classpath "com.android.tools.build:gradle:1.3.0"

I updated to :

classpath "com.android.tools.build:gradle:2.2.0"

Or 1.5.0 and newer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.