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

Fatal Exception: io.realm.exceptions.RealmFileException

      I'm trying to instantiate realm object using this code

      public synchronized Realm provideRealm(){
              if (mRealm == null){
                  Realm.init(mContext);
                  RealmConfiguration config = new RealmConfiguration.Builder()
                          .name("abcdef.realm")
                          .schemaVersion(5)
                          .deleteRealmIfMigrationNeeded()
                          .build();
                  mRealm = Realm.getInstance(config);
              } else if (mRealm.isClosed()){
                  mRealm = null;
                  provideRealm();
              }
              return mRealm;
          }
      

      getting this exception and app is unable to open.

      Fatal Exception: io.realm.exceptions.RealmFileException
      Unable to open a realm at path '/data/data/com.myapp.app/files/abcdef.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.myapp.app/files/abcdef.realm) in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 91
      

      How to solve this problem it is happeing in many devices like huawei, xiaomi...

      Version of Realm and tooling

      Realm version(s): 3.7.2

      Realm sync feature enabled: no

      Android Studio version: 3.0.1

      Android version and device: 7.0, Galaxy S6

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

              Created:
              Updated:
              Resolved: