First of all,
I\'m pretty much aware that a lot of questions on this error had been posted already here, and none of them seems to be having a proper solution especia
Replacing
kapt "android.arch.persistence.room:compiler:$room_version"
by
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
might fix it as well.
After a week's struggle, I finally found the issue.
I added the kotlin-kapt plugin for realm.
And I had a folder named interface itself to hold some interfaces.
I implemented one of the interfaces from the interface folder in MainActivity.
Now the import for the interface was something like this,
import com.android.app.java.interface.Listener
Where, the keyword interface confused the annotation processor, hence caused error while generating stub.
I renamed the folder (from interface to intrface).
That solved the error.
This is a very simple mistake that cost me a week.
Anyway, found the issue. Yay!
For me when I rewrited dao class it solved problem
I put a @Delete annotation on a method with Long parameters :
@Delete
fun deleteRelationShip(userId: Long, friendId: Long)
--debug build can be of help i most cases. In this case it said that a long couldn't be convert in Element
Then it becomes
@Delete
fun deleteRelationShip(relationShip: RelationShip)
I had the same problem. I forgot to add @Dao annotation in my room database
I had a similar issue and spent forever trying to find the issue. I found another thread that you can run Analyze -> Inspect Code to find the issue, but this didn't work for me and showed nothing, but apparently others had success with this.
My issue ended up being with my database (I was using Room) and the fix was simply a matter of removing a "suspend" I had on an insert function in my DAO..
I found this issue by looking in the java generated code folder. Look at all your database files that are generated with "_Impl". The error was highlighted in red and then I could deduce from here what was going wrong (although I don't know why Android Studio couldn't just show me that error in the build output :/ )
Best of luck though! Those kapt errors are the worst