Realm-java: Configurations cannot be different if used to open the same file

Created on 9 Aug 2016  路  5Comments  路  Source: realm/realm-java

Hi, i set realm DefaultConfiguration in Application. And use getDefaultInstance to get Realm.
But, sometimes i get this error when i use getDefaultInstance,compare with Cached configuration and New configuration,I find migration is different. Could you tell me some reason?

Realm version(s): realm 0.88.3
Android Studio version: android studio 2.1.2
Which Android version and device: android 5.1.1 (22)

here is the error log:

java.lang.IllegalArgumentException: Configurations cannot be different if used to open the same file.
Cached configuration:
realmFolder: /data/data/im.mixbox.magnet/files/realm
realmFileName : 57a1631d65d03935dd0010c5.realm
canonicalPath: /data/data/im.mixbox.magnet/files/realm/57a1631d65d03935dd0010c5.realm
key: [length: 0]
schemaVersion: 4
migration: im.mixbox.magnet.data.db.Migration@42b623a8
deleteRealmIfMigrationNeeded: false
durability: FULL
schemaMediator: io.realm.DefaultRealmModuleMediator@647d6e88

New configuration:
realmFolder: /data/data/im.mixbox.magnet/files/realm
realmFileName : 57a1631d65d03935dd0010c5.realm
canonicalPath: /data/data/im.mixbox.magnet/files/realm/57a1631d65d03935dd0010c5.realm
key: [length: 0]
schemaVersion: 4
migration: im.mixbox.magnet.data.db.Migration@42fd6708
deleteRealmIfMigrationNeeded: false
durability: FULL
schemaMediator: io.realm.DefaultRealmModuleMediator@647d6e88

T-Help

Most helpful comment

All 5 comments

Thanks, after check my code, I found it is possible that configuration can be created many times. Now i want to override equals and hashCode and use other way to ensure configuration be created
one time. Hope to solve this bug.

Great! I am closing this issue now. If you still need help on this, feel free to reopen it. Thanks!

I know this issue was resolved long time ago, but I saw same exception when compactOnLaunch is different.
I used lambda method to handle CompactOnLaunchCallback and that caused the issue too.

Well yeah it uses equals on all items provided to the configuration.

Was this page helpful?
0 / 5 - 0 ratings