Reputation: 1447
I have created an SDK which uses Realm db to store data. see code below how i have initialized my sdk db
Realm.init(application);
config = new RealmConfiguration.Builder().name("sdk.db")
.schemaVersion(1)
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(config);
Similarly for App in the application class.
But when i run the app i get following error
io.realm.exceptions.RealmException: Async transaction failed
Caused by: io.realm.exceptions.RealmException: 'class com.models.db.FavouriteIdsModel' is not part of the schema for this Realm.
at io.realm.internal.RealmProxyMediator.getMissingProxyClassException(RealmProxyMediator.java:234) at io.realm.DefaultRealmModuleMediator.getSimpleClassNameImpl(DefaultRealmModuleMediator.java:82) at io.realm.internal.RealmProxyMediator.getSimpleClassName(RealmProxyMediator.java:72) at io.realm.RealmSchema.getTable(RealmSchema.java:177) at io.realm.Realm.delete(Realm.java:1689) at com.jiostb.jiogames.databaserealm.FavouriteMethod$4.execute(FavouriteMethod.java:79) at io.realm.Realm$1.run(Realm.java:1601) at io.realm.internal.async.BgPriorityRunnable.run(BgPriorityRunnable.java:34) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)
and when i see db files, i am getting strange things
Upvotes: 2
Views: 291
Reputation: 81588
There's a chance that the SDK is overriding the default configuration, instead of using its own internal RealmConfiguration.
Also, if a library module wants to expose its schema for another module, you must use @RealmModule
annotation with library = true
, and specify that on the configuration.
Upvotes: 0