Kapt issues with DataBinding

*Binding classes are not generated and I get an Execution failed for task “app:kaptDebugKotlin” error.
It may be an issue with other libraries in my app, but i am unable to reach to the point of failure.
Following libraries are currently used in project:

Dagger 2
RxJava 2
Databinding
Kotlin
Butterknife
Groupie (from lisawray)

I made some changes to add dagger.android support, and now i am unable to run the project and the error shows:

e: public class OrderBookItem extends Item {
e: ^
e: symbol: class RowOrderBookBinding
e: \app\src\main\java\com\somepackage\mobile\mf\reports\item\OrderBookItem.java:26: error: cannot find symbol
e:

e: @Override public void bind(RowOrderBookBinding viewBinding, int position) {
e: ^
e: symbol: class RowOrderBookBinding
e: location: class OrderBookItem

Around 40-50 errors of same type.
As I have around 40-50 layouts that use DataBinding.

I think we may be encountering the same issue. I have created another discussion with more details here. Currently stuck in the spam filter, but the link should work soon.

Hi, friend! Did you solve this problem? I use databiding & kotlin, yestoday ago, my project is all right. but last night, I don’t know why my project cannot be compiled! It’s too bad.

Since I had just started kotlin integration, and it’s only limited to data
classes.
I created a copy of my project without kotlin, so if I working on a change
which breaks the build I do the same in the NoKotlin copy, find the issue
and resolve it.

I know it sounds stupid but I have not been able to find a better way.
I am holding off further kotlin conversion until there is a better way.

This bug report was posted in the thread I linked earlier, but I figured I would put it here too. It sounds like it should fix the issue you are having.

https://youtrack.jetbrains.com/issue/KT-21264

Did you get it fixed? Yesterday I implemented data binding in my kotlin android project, with dagger as DI.
When I tried to @Provides databinding it failed because dagger can’t find the generated class (NonExsitentClass error). When I use data binding without trying to provide it through the object graph - it works fine.

any idea? I feel like I’m doing half the work, not injecting the binding

I am having the same error here, using the latest stable Android Studio 3.2 and Kotlin 1.2.71.
When using Data Binding sometimes the build just fails and I cannot seem to find the reason for it. I get a lot of error: cannot find symbol errors. Apparently the binding classes are not being generated and then the project fails to build. Usually, reverting the latest commit fixes it and it works again, indicating that I made some mistake in my code, the issue is that it is impossible to find where, as it does not show the proper error in the log, just these cannot find symbol errors. Any tips on how to fix this, or to get the proper cause of the error?

2 Likes

Slightly different error, but with Dagger 2.16 and above I am getting an error with Kapt
error: Dagger does not support injection into private fields.
Upon investigation, the field has indeed been translated into a Private field in the Auto Generated Java file, during compilation by kapt
Has anyone seen this error, is there a fix available?

Yes, I found the same issue. Please any updates?