When I eat something to write to the Realm crashes. I did everything in the tutorial

java.lang.IllegalArgumentException: A non-null RealmConfiguration must be provided

code from Application:

 public class App extends Application { @Override public void onCreate() { super.onCreate(); Realm.init(this); Realm.setDefaultConfiguration(new RealmConfiguration .Builder() .deleteRealmIfMigrationNeeded() .name(Realm.DEFAULT_REALM_NAME) .modules(new ShopingListModule()) .build()); }} 

Flies out on the line in the presenter when I want to get or write something to the database:

 Realm realm = Realm.getInstance(Realm.getDefaultConfiguration()); 

I did not find information on the Internet. Who faced how to decide?

  • Realm.getDefaultInstance () isn't it a similar call? Well, by the way, it doesn’t matter, you need to log it, and watch at what point the configs are rubbed, mb deleteRealmIfMigrationNeeded () erases? - Shwarz Andrei
  • @ShwarzAndrei deleteRealmIfMigrationNeeded () does not overwrite already tried to remove. And where is the log set? I set up the configuration in Application, I switch to other activations and try to write down there and the error in the first row I write - JunDev
  • yes just run it, put the watcher on the config, and see when it becomes null - Shwarz Andrei

0