open() failed: Read-only file system in io_realm_internal_SharedGroup.cpp line 109

84 views
Skip to first unread message

simon

unread,
Dec 17, 2014, 1:32:28 PM12/17/14
to realm...@googlegroups.com
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!

Brian Munkholm

unread,
Dec 17, 2014, 2:17:20 PM12/17/14
to Simon, realm...@googlegroups.com
Hi,
You should ensure that the REALM_NAME should be including full path to a location that is writable.

Cheers

--
Brian Munkholm



--
You received this message because you are subscribed to the Google Groups "Realm Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to realm-java+...@googlegroups.com.
To post to this group, send email to realm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/realm-java/8475a783-d79f-48e8-ba28-370ffd73af28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



{#HS:61056015-186#}
Reply all
Reply to author
Forward
0 new messages