I'm getting java.lang.BootstrapMethodError: java.lang.IllegalAccessError: tried to access class kotlin.jvm.internal.DefaultConstructorMarker from class androidx.room.CoroutinesRoom$Companion
with the following test, why?
@RunWith(AndroidJUnit4::class)
class DBTest {
@Test
@Throws(Exception::class)
fun basicOperations() = runBlocking {
val context = ApplicationProvider.getApplicationContext<Context>()
val db = Room.inMemoryDatabaseBuilder(context, AppDatabase::class.java).build()
db.favDao().insertFav(Fav("whatever"))
assertEquals("whatever", db.favDao().getFav("whatever"))
db.favDao().deleteFav(Fav("whatever"))
assertEquals(null, db.favDao().getFav("whatever"))
db.close()
}
}
I pretty much just copied from the docs.
I'm using the latest room-coroutines
as there was recent media coverage about it from Google.
As of 3/21/19 a fix was introduced in the snapshot of Robolectric, it should be included in future releases:
https://github.com/robolectric/robolectric/commit/6d246391fdaac92968811bc83e1afb057e6f93a3
The cause was due to an internal annotation on the companion object of CoroutinesRoom class.