android - No default RealmConfiguration was found. Call setDefaultConfiguration() first -
i'm using realm database android application. not sure why happens everytime uninstall app, first run crashes in activity on:
realm = realm.getdefaultinstance(); crash message:
caused by: java.lang.nullpointerexception: no default realmconfiguration found. call setdefaultconfiguration() first in application class have this:
@override public void oncreate() { super.oncreate(); realmconfiguration config = new realmconfiguration.builder(this) .name("mydb.realm") .deleterealmifmigrationneeded() .schemaversion(1) .migration(new migration()) .build(); realm.setdefaultconfiguration(config); //...crashlytics , other things... } all future runs after crash ok. ideas?
i found problem. realm had nothing it. custom application's oncreate never called on first app run because of allowbackup attribute in manifest. setting false fixed issue.
Comments
Post a Comment