jean
01/26/2022, 8:49 PMimport io.realm.query
it is not resolved.
I do have access to realm.write { … }
but not realm.query<MyObject>()
.
And I do have
id("io.realm.kotlin") version "0.8.2"
and
val commonMain by getting {
dependencies {
implementation("io.realm.kotlin:library-base:0.8.2")
}
}
in my build.gradle.kts
. Am I missing something there?Nabil
01/26/2022, 10:22 PMimport io.realm.objects
realm.objects<MyObject>().query("your query")
You can see updated samples using 0.8.2
here (query examples: https://github.com/realm/realm-kotlin-samples/blob/main/Bookshelf/shared/src/commonMain/kotlin/io/realm/sample/bookshelf/database/RealmDatabase.kt)Claus Rørbech
01/26/2022, 10:22 PM0.9.0
-release. If you already want to try it out you can use the 0.9.0-SNAPSHOT
following the "Using Snapshots" from the readme in the root of the repository.jean
01/27/2022, 7:49 AMCould not resolve io.realm.kotlin:library-base:0.9.0-SNAPSHOT
. I guess this section of the documentation needs to be updated since it foes not work with 0.8.2
? https://github.com/realm/realm-kotlin#queryClaus Rørbech
01/28/2022, 10:39 AMClaus Rørbech
01/28/2022, 10:40 AM0.8.2
can be found at https://github.com/realm/realm-kotlin/tree/v0.8.2#queryjean
01/28/2022, 2:35 PMjava.lang.ExceptionInInitializerError
at io.realm.RealmConfiguration$Builder.build(RealmConfiguration.kt:61)
at io.realm.RealmConfiguration$Companion.with(RealmConfiguration.kt:85)
at no.myleadership.common.database.DatabaseTest$should create and init database$1.invokeSuspend(DatabaseTest.kt:22)
at no.myleadership.common.database.DatabaseTest$should create and init database$1.invoke(DatabaseTest.kt)
at no.myleadership.common.database.DatabaseTest$should create and init database$1.invoke(DatabaseTest.kt)
at no.myleadership.common.TestUtilsAndroidKt$runBlockingTest$1.invokeSuspend(TestUtilsAndroid.kt:13)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException: RELEASE must not be null
at io.realm.internal.platform.SystemUtilsAndroidKt.<clinit>(SystemUtilsAndroid.kt:8)
... 11 more
for this simple test
class DatabaseTest {
class Frog : RealmObject {
var name: String = ""
var age: Int = 0
var species: String? = null
var owner: String? = null
}
@Test
fun `should create and init database`() = runBlockingTest {
val config = RealmConfiguration.with(schema = setOf(Frog::class))
val realm = Realm.open(config)
}
}
Claus Rørbech
01/28/2022, 2:44 PMjvm()
target.jean
01/28/2022, 7:30 PMcommonTest
of a kmm project targeting android and ios. I’ll add the tests in jvmTest
and see how it goes 🙂