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

lateinit property filesDir has not been initialized

      How frequently does the bug occur?

      Once

      Description

      A crash is being reported to PlayStore Console for the device "samsung r0s" after upgrading to Kotlin Realm 2.1.0

      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
      Exception java.lang.RuntimeException:
        at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4164)
        at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4322)
        at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:103)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:139)
        at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:96)
        at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2685)
        at android.os.Handler.dispatchMessage (Handler.java:106)
        at android.os.Looper.loopOnce (Looper.java:230)
        at android.os.Looper.loop (Looper.java:319)
        at android.app.ActivityThread.main (ActivityThread.java:8919)
        at java.lang.reflect.Method.invoke
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578)
        at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
      Caused by 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 io.realm.kotlin.RealmConfiguration$Companion.create (RealmConfiguration.kt:196)
        at com.nearmeentertainment.vegasnearme.MainActivity.onCreate (MainActivity.kt:238)
        at android.app.Activity.performCreate (Activity.java:8975)
        at android.app.Activity.performCreate (Activity.java:8944)
        at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1456)
        at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4146)
      

      Can you reproduce the bug?

      No

      Reproduction Steps

      No response

      Version

      2.1.0

      What Atlas App Services are you using?

      Atlas Device Sync

      Are you using encryption?

      Yes

      Platform OS and version(s)

      Android 14 (SDK 34)

      Build environment

      Android Studio version: Koala Feature Drop | 2024.1.2
      Android Build Tools version: 35
      Gradle version: 8.0.2

      Similar to the issue described here but Hilt is not used https://github.com/realm/realm-kotlin/issues/1799

      lateinit var realmLocal: Realm
      
      // MainActivity:238
      realmLocal = Realm.open(RealmConfiguration.create(schema = setOf(Items.Item::class)))
      

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

              Created:
              Updated: