Room Persistence Library run time exception when calling Rooms inMemoryBuilder method

前端 未结 8 927
不思量自难忘°
不思量自难忘° 2020-12-09 16:13

When following the tutorial for setting up the Room persistence library I run in to this error when testing on an Android device.

java.lang.RuntimeException: cannot

相关标签:
8条回答
  • 2020-12-09 16:39

    You must add the annotation processor dependency to the module where your AppDatabase is. I assumed that the app would take the depencency from my API library module, where my data model classes are, but apparently this is not the case.

    Answer came from this google issue: https://issuetracker.google.com/issues/67520422 And this SO answer: https://stackoverflow.com/a/43918701/1959110

    0 讨论(0)
  • 2020-12-09 16:41

    I changed the 'annotationProcessor' keyword to 'kapt' in my gradle file. Like so:

    kapt "android.arch.persistence.room:compiler:1.0.0"
    
    0 讨论(0)
提交回复
热议问题