Search code examples
androidjenkinsdagger-2android-databindingdagger

Jenkins: Android Project Failing to build (fails generating databinding/dagger classes)


The android team at my workplace is trying to get C.I. with Jenkins working, but jenkins is having troubles building the project. The project builds correctly on our dev machines with the command line below, but fails to build on the Jenkins machine. Note: we have another project that jenkins was able to build that contains databinding and dagger.

The error we receive is

:app:compileDevDebugJavaWithJavac/<some-file-path> - <some_class>:27: error: cannot find symbol
import <DaggerGeneratedClass>;

We know that the databinding classes are not being generated. If we go to our build directory "intermediates/classes//debug//databinding" we see that nothing there, but on our dev machines the databinding classes do generate. Does anyone know how to resolve this?

Command line to build project

./gradlew assemble

Solution

  • We found a solution to our problem. Although we do not know why this solution worked. We use kotlin in our project and switched all our annotationProcessors to kapt.

    kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
    kapt "com.google.dagger:dagger-compiler:$daggerVersion"
    kapt "com.jakewharton:butterknife-compiler:$butterknifeVersion"
    kapt "com.android.databinding:compiler:$plugin_version"