Gradle 2.3.0-alpha1 doesn't work data binding
Asked Answered
S

3

17

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

Shelf answered 12/11, 2016 at 11:38 Comment(11)
what do you need dataBinder for?Acuna
I only follow android data binding guidelines. any problem with dataBinder ?Shelf
see developer.android.com/topic/libraries/data-binding/…Acuna
I tried to remove the line classpath 'com.android.databinding:dataBinder:1.0-rc1' but it still keep show error aboveShelf
Same problem here.Tubby
I'm guessing this is a problem related to android-apt.Loren
Maybe. I was struggling on google but there's no luck :(Shelf
had the same issue, it is coming from the new gradle pluging, you need to revert back to - classpath 'com.android.tools.build:gradle:2.2.2'on your main gradle file. But Then you must go back to Android Studio 2.2.2. both did the trick for meKingery
Agree. I also did that - back to gradle 2.2.2 + Android Studio 2.2.2 and everything works fine. But I really need my project can run on AS 2.3 because Instant run very very slow (4 - 6 minutes) and it was fixed on AS 2.3 :)Shelf
There are already two android issues filed: code.google.com/p/android/issues/detail?id=227612 and code.google.com/p/android/issues/detail?id=227657. For me it is enough to downgrade the gradle plugin to 2.2.2 for successful builds.Winsor
Yes we can downgrade to gradle 2.2.2 but it's bug and it should be fixed asapShelf
T
6

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 .

Turd answered 18/11, 2016 at 16:10 Comment(1)
Please share a sample app in the bug report that reproduces your issue.Turd
O
4

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'

Overstreet answered 3/3, 2017 at 6:3 Comment(1)
Do you have any ideas about androidTestApt ? after removing the android-apt I have an error on build process :(Fuhrman
P
-4

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 :)

Puccini answered 17/11, 2016 at 17:22 Comment(1)
it costs me 2 - 3 minutes for each time running the app :)) it's so 'amazing' (crying)Shelf

© 2022 - 2024 — McMap. All rights reserved.