Reputation: 160
I have @Insert method in Dao interface like this:
@Insert(onConflict = REPLACE)
fun insertOrUpdateAllMessages(vararg messages: QuestMessageDbModel): Completable
When I build my project I get error:
error: local variable questsModels is accessed from within inner class; needs to be declared final
__insertionAdapterOfQuestDbModel.insert(questsModels);
^
When I open generated QuestDao_Impl.java, I see there such code:
What am I doing wrong? I tried to replace vararg argument with List, but got same error.
Upvotes: 0
Views: 251
Reputation: 110
As said in this stackoverflow question, enabling java8 compatibility fixes the problem.
Add this to your desired project module gradle file, inside the android closure:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Upvotes: 1