Search code examples
androidrealmokhttprealm-migration

Unable to get the exact reason of crash while using Realm + Okhttp


I am using Realm and my app crashes with the following traces and I don't get any idea to resolve this. This is the only stack strace that I see on the console. Nothing else :

FATAL EXCEPTION: OkHttp Dispatcher
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
 at io.realm.RealmConfiguration.equals(RealmConfiguration.java:186)
 at io.realm.RealmCache.validateConfiguration(RealmCache.java:217)
 at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:103)
 at io.realm.Realm.getInstance(Realm.java:213)
 at io.realm.Realm.getInstance(Realm.java:176)
 at testapp.WebClient.WebClientAPICalls$2.onResponse(WebClientAPICalls.java:74)
 at okhttp3.RealCall$AsyncCall.execute(RealCall.java:133)
 at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
 at java.lang.Thread.run(Thread.java:818)

This is the line 74: Realm realm = Realm.getInstance(context);

I am not sure what the exact reason is for this crashing. Any help in this regard is highly appreciated.


Solution

  • So just for the information to the people out here, as confirmed by @ Christian Melchior, it was a bug with the latest version of realm 0.88.0.
    Hence I had to rollback to the version 0.87.5 for now in order to resolve the issue.

    Christian Melchior, who works at @Realm.io has also confirmed that they are releasing a fix for this bug as soon as possible and hence the latest version should be good to go.