Hi there,
I'm running into an exception every I change my realm schema (by adding/removing variables with getters/setters from Objects that extend RealmObject). The exception and stack trace is below:
java.lang.RuntimeException: Unspecified exception. open() failed: Read-only file system in io_realm_internal_SharedGroup.cpp line 109
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(Native Method)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:57)
at io.realm.Realm.<init>(Realm.java:143)
at io.realm.Realm.createAndValidate(Realm.java:472)
at io.realm.Realm.migrateRealmAtPath(Realm.java:958)
at io.realm.Realm.migrateRealmAtPath(Realm.java:945)
My code does the following:
Realm realm;
try {
realm = Realm.getInstance(context, REALM_NAME);
} catch(RealmMigrationNeededException ex) {
Realm.migrateRealmAtPath(REALM_NAME, new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
// Migrate from version 1 to 2
if (version == 1) {
Table userTable = realm.getTable(UserModel.class);
// adding columns
version++;
}
if (version == 2) {
Table userTable = realm.getTable(UserModel.class);
// adding columns
version++;
}
return version;
}
});
realm = Realm.getInstance(context);
}
REALM_NAME is just set to db.realm.
Is this a known issue? Am I performing migrations incorrectly? Lastly, please let me know if I can provide any more useful info to help debug this.
My build.gradle file has the line: compile 'io.realm:realm-android:0.75.1' to include realm in my project.
Thanks!