Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-240

Incompatible histories. Expected a Realm with no or in-realm history

      We get the following exception when trying to open the default realm:

      FATAL EXCEPTION: main
      Process: com.anghami, PID: 8169
      java.lang.RuntimeException: Unable to create application com.anghami.AnghamiApplication: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.anghami/files/default.realm': Incompatible histories. Expected a Realm with no or in-realm history. (Incompatible histories. Expected a Realm with no or in-realm history) (/data/data/com.anghami/files/default.realm) in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 252 Kind: ACCESS_ERROR.
          at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5973)
          at android.app.ActivityThread.-wrap3(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:154)
          at android.app.ActivityThread.main(ActivityThread.java:6776)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
       Caused by: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.anghami/files/default.realm': Incompatible histories. Expected a Realm with no or in-realm history. (Incompatible histories. Expected a Realm with no or in-realm history) (/data/data/com.anghami/files/default.realm) in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 252 Kind: ACCESS_ERROR.
          at io.realm.internal.SharedRealm.nativeGetSharedRealm(Native Method)
          at io.realm.internal.SharedRealm.<init>(SharedRealm.java:186)
          at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:239)
          at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:202)
          at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:298)
          at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:284)
          at io.realm.Realm.getDefaultInstance(Realm.java:281)
          at com.anghami.data.local.RealmHelper.call(RealmHelper.java:155)
          at com.anghami.data.local.RealmHelper.call(RealmHelper.java:148)
          at com.anghami.config.RealmConfig.initialize(RealmConfig.java:76)
          at com.anghami.AnghamiApplication.onCreate(AnghamiApplication.java:69)
          at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032)
          at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5970)
          at android.app.ActivityThread.-wrap3(ActivityThread.java) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710) 
          at android.os.Handler.dispatchMessage(Handler.java:102) 
          at android.os.Looper.loop(Looper.java:154) 
          at android.app.ActivityThread.main(ActivityThread.java:6776) 
          at java.lang.reflect.Method.invoke(Native Method) 
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
      

      This realm doesn't use encryption(and we've never used it on the default realm) but another realm in the same app does use encryption.

      I will attach the actual realm file that's causing this blowup in a bit

      Version of Realm and tooling

      Realm version(s): 3.5.0

      Realm sync feature enabled: no

      Android Studio version: Android Studio 3.0 beta 2

      Which Android version and device: Android 7.0 running on a Samsung S8+

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

              Created:
              Updated:
              Resolved: