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

Popular posts from this blog

multithreading - Exception in Application constructor -

React Native allow user to reorder elements in a scrollview list -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -