Giter Club home page Giter Club logo

Comments (5)

sync-by-unito avatar sync-by-unito commented on September 25, 2024

➤ PM Bot commented:

Jira ticket: RJAVA-1253

from realm-java.

kneth avatar kneth commented on September 25, 2024

@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?

from realm-java.

Okuro3499 avatar Okuro3499 commented on September 25, 2024

I still get the same exception

from realm-java.

rorbech avatar rorbech commented on September 25, 2024

@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.

from realm-java.

Okuro3499 avatar Okuro3499 commented on September 25, 2024

@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)

from realm-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.