You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lateinit var realm: Realm
suspend fun createRealm(realmName: String) {
val downloadResult = langDownloader.download(
"link_to_realm",
realmName
)
delay(5000)
when(downloadResult) {
is DownloadLangResult.Success -> {
val configuration =
RealmConfiguration.Builder(setOf(StringResourceRealm::class))
.directory(downloadResult.directory)
.name(downloadResult.name)
.build()
realm = Realm.open(configuration)
}
is DownloadLangResult.Failed -> {
Toast.makeText(
context,
downloadResult.exception.message ?: "Pull language failed",
Toast.LENGTH_SHORT
).show()
return
}
}
}
I have make sure that the downloaded realm file is exists in the app's /files directory.
I get the same error when use RealmConfiguration.create(setOf(StringResourceRealm::class))
Stacktrace & log output
kotlin.UninitializedPropertyAccessException: lateinit property filesDir has not been initialized
at io.realm.kotlin.internal.RealmInitializer$Companion.getFilesDir(RealmInitializer.kt:34)
at io.realm.kotlin.internal.platform.SystemUtilsAndroidKt.appFilesDirectory(SystemUtilsAndroid.kt:30)
at io.realm.kotlin.RealmConfiguration$Builder.<init>(RealmConfiguration.kt:54)
at com.staff.dynamic_langs.RealmDatabaseManager.createRealm(RealmDatabaseManager.kt:48)
at com.staff.dynamic_langs.RealmDatabaseManager$createRealm$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@3cce21c, Dispatchers.IO]
Can you reproduce the bug?
Always
Reproduction Steps
Project gradle:
plugins {
...
id("io.realm.kotlin") version "2.0.0" apply true
}
tasks.create<Delete>("cleanRP") {
group = "rp"
delete(
fileTree(rootProject.buildDir)
)
}
How frequently does the bug occur?
Always
Description
I am using Realm-kotlin Android version 2.0.0. I add Realm follow the https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/install/#std-label-kotlin-install-android. I did notice that this is for version 1.16.0 but cannot find instruction for version 2.0.0 ( I found one in the example but it used the kotlin multiplatform) and got error when create a Realm by this:
I have make sure that the downloaded realm file is exists in the app's
/files
directory.I get the same error when use
RealmConfiguration.create(setOf(StringResourceRealm::class))
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
Project gradle:
App gradle:
How I create Realm:
Version
2.0.0
What Atlas App Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
Samsung A15 OneUI 6.1 and Android Emulator Pixel 8 API 34
Build environment
Android Studio version: Android Studio Koala | 2024.1.1
Android Build Tools version: 8.5
Gradle version: 8.7
The text was updated successfully, but these errors were encountered: