KhoaHA
KhoaHA

Reputation: 171

Gradle 2.3.0-alpha1 doesn't work data binding

I have a problem after updating to Android Studo 2.3 Canary today.

The build completed with no error but when I run the app, the gradle console keeps showing:

android.databinding.annotationprocessor.ProcessDataBinding not found

Here's my build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle 2.3.0-alpha1'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.android.databinding:dataBinder:1.0-rc1'
        classpath 'me.tatarka:gradle-retrolambda:3.3.1'
        classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Thanks !

---Updated--- I was struggling for few days and I found where problem comes from. I use Parcels, Retrolamdas in my app, both libraries use 'apt' and that's problem.

build.gradle (root) bug version :

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.android.databinding:dataBinder:1.0-rc1'
        classpath "me.tatarka:gradle-retrolambda:3.2.3"
        classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

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

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

**build.gradle (app) bug version **

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'android-apt'

...

dependencies {
    compile 'org.parceler:parceler-api:1.1.5'
    apt 'org.parceler:parceler:1.1.5'
}

And here is fixed. build.gradle (root) fixed version :

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0-alpha1'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.3.1'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (app) fixed version*

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

compile 'org.parceler:parceler-api:1.1.5'
annotationProcessor 'org.parceler:parceler:1.1.5'

Conclusion. I changed retrolamdas repo version and remove plugin: 'android-apt' .I was found some helpful links if you want looks into details.

https://github.com/johncarl81/parceler/issues/201 https://bitbucket.org/hvisser/android-apt/wiki/Migration

Hope it helps :D

Upvotes: 17

Views: 2384

Answers (3)

Dhaval Jivani
Dhaval Jivani

Reputation: 9697

I was using android-apt. I replaced with annotationProcessor and solve my problem

I have removed

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

and changed Dagger library code

compile 'com.google.dagger:dagger:2.7'

annotationProcessor 'com.google.dagger:dagger-compiler:2.7'

provided 'org.glassfish:javax.annotation:10.0-b28'

Upvotes: 4

yigit
yigit

Reputation: 38263

This issue is triggered because we've moved data binding to annotationProcessor configuration (rather than provided). If you are using android-apt`, they'll conflict, stop using it. We also had another bug which prevented it from picking other processors. It is already fixed and will be available in the next alpha.

Original bug report here: https://code.google.com/p/android/issues/detail?id=227612. It also has a work around if you really need to use 2.3 .

Upvotes: 6

Andrii Kovalchuk
Andrii Kovalchuk

Reputation: 4897

Temporaral fix that worked for me: 1. Change gradle version to: classpath 'com.android.tools.build:gradle:2.2.2'

  1. Turn off instant run

  2. Wait for an update from Google :)

Upvotes: -4

Related Questions