Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-1066

Unable to use initialRealmFile with compose multiplatform resources

      How frequently does the bug occur?

      Always

      Description

      Compose multiplatform 1.6.0 introduced native support for resources
      Placing a realm file into composeResources/files and then using it in a real configuration via .initialRealmFile("...") results in an error that asset file is not found

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      Caused by: java.lang.IllegalArgumentException: Asset file not found: 'ral_colors.realm'
      	at io.realm.kotlin.internal.util.Exceptions.assetFileNotFound(Exceptions.kt:26)
      	at io.realm.kotlin.internal.platform.SystemUtilsAndroidKt.assetFileAsStream(SystemUtilsAndroid.kt:36)
      	at io.realm.kotlin.internal.platform.SystemUtilsKt.copyAssetFile(SystemUtils.kt:66)
      	at io.realm.kotlin.internal.RealmImpl$1.invokeSuspend(RealmImpl.kt:128)
      	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
      	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
      	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
      	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
      	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
      	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
      	at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking(CoroutineUtilsSharedJvm.kt:22)
      	at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking$default(CoroutineUtilsSharedJvm.kt:21)
      	at io.realm.kotlin.internal.RealmImpl.<init>(RealmImpl.kt:115)
      	at io.realm.kotlin.internal.RealmImpl.<init>(Unknown Source:0)
      	at io.realm.kotlin.internal.RealmImpl$Companion.create$io_realm_kotlin_library(RealmImpl.kt:318)
      	at io.realm.kotlin.Realm$Companion.open(Realm.kt:83)
      	at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:50)
      	... 149 more
      Caused by: java.io.FileNotFoundException: ral_colors.realm
      	at android.content.res.AssetManager.nativeOpenAsset(Native Method)
      	at android.content.res.AssetManager.open(AssetManager.java:904)
      	at android.content.res.AssetManager.open(AssetManager.java:881)
      	at io.realm.kotlin.internal.RealmInitializer$Companion.asset(RealmInitializer.kt:36)
      	at io.realm.kotlin.internal.platform.SystemUtilsAndroidKt.assetFileAsStream(SystemUtilsAndroid.kt:34)
      	... 167 more
      

      Can you reproduce the bug?

      Always

      Reproduction Steps

      1. Setup a compose multiplatform project with compose version 1.6.0 or higher
      2. Place a realm file into composeResources/files
      3. Attempt to use that file as a inital realm file via .initialRealmFile("...")

      Version

      1.14.1

      What Atlas App Services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      Android

      Build environment

      Android Studio version: 2023.2.1
      Android Build Tools version: agp 8.2.2
      Gradle version: 8.4

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: