Unable to configure Android data binding plugin

I am trying to use the android data binding plugin without the knowledge so far.

I use: Gradle 2.2.1; Intellij IDEA 15.

Build.gradle project level:

buildscript {
repositories {
    jcenter()
}
dependencies {

    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath "com.android.databinding:dataBinder:1.0-rc2"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {
repositories {
    jcenter()
    }
}

Build.gradle module:

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

buildscript {
repositories {
    jcenter()
}
dependencies {

}
}

repositories {
jcenter()
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.example.app4.app4"
    minSdkVersion 10
    targetSdkVersion 10
    versionCode 1
    versionName "1.0"
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_6
    targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),              'proguard-rules.pro'
    }
}

dataBinding {
    enabled = true
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
}

I got a few different errors when trying to change the plugin version; The error I am getting now is "Error: Gradle: There was a problem setting up the project: app4".

Failed to notify listener on project evaluation. android.databinding.tool.LayoutXmlProcessor (Ljava / languages ​​/ String; Landroid / data binding / tool / records / JavaFileWriter; IZLandroid / data binding / tool / LayoutXmlProcessor $ OriginalFileLookup;). IN "

+4
source share
1

, . , , dataBinding {enabled = true;} : SDK, , 10 .

:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.yourappname"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0" 


    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true;
    }
}

dependencies {
    //other dependencies
}

, neenbedankt gradle, .

+7

Source: https://habr.com/ru/post/1624095/


All Articles