1. Hugo Visser
  2. android-apt
  3. Issues

Issues

Issue #59 invalid

Android DataBinding + Lombok

roadgazer_dev
created an issue

I'm trying to build the project with lombok and binding, but get an error. How do I fix this?

I need to annotation lombok process before android data binding

error

:PicketNavigator:compileX86DebugJavaWithJavac
/Users/jaboko/Development/ddg/intari/intati-picket-navigator/PicketNavigator/src/main/java/ru/ddgcorp/picketnavigator/core/Model/Login.java:25: error: package ru.ddgcorp.picketnavigator.databinding does not exist
import ru.ddgcorp.picketnavigator.databinding.LogoutDlgNewBinding;
                                             ^

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':PicketNavigator:compileX86DebugJavaWithJavac'.
> java.lang.RuntimeException: Found data binding errors.
  ****/ data binding error ****msg:Could not find accessor ru.ddgcorp.picketnavigator.core.utils.server.response.User.workerRole file:/Users/jaboko/Development/ddg/intari/intati-picket-navigator/PicketNavigator/src/main/res/layout/logout_dlg_new.xml loc:72:32 - 72:52 ****\ data binding error ****

root

    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }

app

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

android {

     ....

    dataBinding {
        enabled = true
    }

dependencies {

        compile fileTree(include: ['*.jar'], dir: 'libs')

        ....

        apt 'org.projectlombok:lombok:1.+'
        provided 'org.projectlombok:lombok:1.+'
    }

User class

public class User {
    @Getter @Setter
    private WorkerRole workerRole;
}

Comments (3)

  1. Hugo Visser repo owner

    There's no reason why you should use both apt and provided for lombok, but that's probably not the reason why it's failing. From the error it seems that data binding is looking at your Java source class, while lombok is instrumenting the class files.

    I doubt this is a bug in android-apt but rather an incompatibility between lombok (which does funny things for an annotation processor) and databinding.

  2. Senthil S

    This bug still exists.

    Changed apt -> androidProcessor

    Feel, lambok is generating setters and getters little later but databinding is looking it way ahead.

  3. Log in to comment