Last active
March 15, 2016 11:30
-
-
Save alhazmy13/ce7a1d2795a8b42110ec to your computer and use it in GitHub Desktop.
RealmMigration must be provided
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you don't have any problem in loosing your old data then you can delete Realm Configuration and create new one. | |
------------------------------------------------------------------------------- | |
Realm realm = null; | |
try { | |
realm = Realm.getInstance(MainActivity.this); | |
} catch (RealmMigrationNeededException r) { | |
Realm.deleteRealmFile(MainActivity.this); | |
realm = Realm.getInstance(MainActivity.this); | |
} | |
------------------------------------------------------------------------------- | |
OR to keep your data | |
------------------------------------------------------------------------------- | |
RealmConfiguration config2 = new RealmConfiguration.Builder(this) | |
.name("default2") | |
.schemaVersion(3) | |
.deleteRealmIfMigrationNeeded() | |
.build(); | |
realm = Realm.getInstance(config2); | |
------------------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment