I am getting an io.realm.exceptions.RealmError
for some users in my android application.
public Realm getRealm(){
RealmConfiguration config = new RealmConfiguration.Builder()
.schemaVersion(0)
.deleteRealmIfMigrationNeeded()
.build();
return Realm.getInstance(config); //getting error at this line
}
realm version: 3.7.2
Please tell me how to fix that.
The way i coded Realm was by initializing the default instance in the application using the following code.
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
.name(REALM_DB_NAME)
.schemaVersion(0)
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(realmConfiguration);
An everytime i wanted to get an instance of realm i would use the following command.
Realm realm = Realm.getDefaultInstance();