Open Okuro3499 opened 3 months ago
➤ PM Bot commented:
Jira ticket: RJAVA-1253
@Okuro3499 Thank you for reporting.
Do you expect a schema migration? If so, the file will be deleted, and the schema version will be set to zero. What if you remove schemaVersion(4)
- will you still see the exception?
I still get the same exception
@Okuro3499 Hmm, usually RealmFileException
should have some more details about what is going on. Can it be that there is a file on the device when you throught play store, but not when you test it locally?
Seems like you are initializing the default configuration each time you call the get
-ter of realm
. You should probably just initialize and default configuration in init
and then obtain the actual instance when calling get
:
init {
Realm.init(context)
val config = RealmConfiguration.Builder()
.name(Realm.DEFAULT_REALM_NAME)
.deleteRealmIfMigrationNeeded().schemaVersion(4).build()
Realm.setDefaultConfiguration(config)
}
val realmInstance: Realm
get() {
return Realm.getInstance()
}
Not sure it has anything to do with your issue, but could be have an impact dependent on the rest of your realm-usage throughout the app.
Maybe try enabling logging in init
with:
RealmLog.setLevel(LogLevel.DEBUG);
And see if you can catch more info on the error ... or post the output here for us to interpret it.
@rorbech I implemented as you advised and app still crashes on the device but log remains the same for the crash. checked the device and there is no new file created on the device when you downloaded through play store
class DatabaseService(context: Context) {
init {
Realm.init(context)
RealmLog.setLevel(LogLevel.DEBUG)
val config = RealmConfiguration.Builder()
.name(Realm.DEFAULT_REALM_NAME)
.deleteRealmIfMigrationNeeded()
.schemaVersion(4)
.allowWritesOnUiThread(true)
.build()
Realm.setDefaultConfiguration(config)
}
val realmInstance: Realm
get() {
return Realm.getDefaultInstance()
}
}
error is still same and only one type of device is still affected
Exception java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3946)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4126)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:108)
at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem (TransactionExecutor.java:195)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:157)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:90)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2544)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loopOnce (Looper.java:232)
at android.os.Looper.loop (Looper.java:317)
at android.app.ActivityThread.main (ActivityThread.java:8501)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:878)
Caused by io.realm.exceptions.RealmFileException:
at io.realm.internal.OsSharedRealm.nativeGetSharedRealm
at io.realm.internal.OsSharedRealm.<init> (OsSharedRealm.java:175)
at io.realm.internal.OsSharedRealm.getInstance (OsSharedRealm.java:260)
at io.realm.BaseRealm.<init> (BaseRealm.java:142)
at io.realm.BaseRealm.<init> (BaseRealm.java:109)
at io.realm.Realm.<init> (Realm.java:161)
at io.realm.Realm.createInstance (Realm.java:535)
at io.realm.RealmCache.createInstance (RealmCache.java:508)
at io.realm.RealmCache.doCreateRealmOrGetFromCache (RealmCache.java:461)
at io.realm.RealmCache.createRealmOrGetFromCache (RealmCache.java:422)
at io.realm.Realm.getDefaultInstance (Realm.java:443)
at org.ole.planet.myplanet.datamanager.DatabaseService.getRealmInstance (DatabaseService.kt:22)
at org.ole.planet.myplanet.ui.sync.SyncActivity.onCreate (SyncActivity.kt:151)
at org.ole.planet.myplanet.ui.sync.DashboardElementActivity.onCreate (DashboardElementActivity.kt:45)
at org.ole.planet.myplanet.ui.dashboard.DashboardActivity.onCreate (DashboardActivity.kt:79)
at android.app.Activity.performCreate (Activity.java:8767)
at android.app.Activity.performCreate (Activity.java:8745)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1519)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3928)
How frequently does the bug occur?
Always
Description
My app seems to be crashing on a Google pixel 8 (Android 14) every time it starts and
io.realm.exceptions.RealmFileException
is logged and it seems to be only happening on the app published on play store if I build from Android studio the crash does not occur. This is my realm initialization classStacktrace & log output