Realm.getDefaultModule()返回null

时间:2015-07-16 09:14:53

标签: android realm

按照说明here, 我试图为我的主要领域设置2个模块,AccountModule和TripModule是他们各自项目中的类(他们坐在他们自己的项目中)

@RealmModule(library = true, allClasses = true)
public class AccountModule {
    //nothing here
}




@RealmModule(library = true, allClasses = true)
public class TripModule {
    //nothing here
}

在应用程序项目中,我将它们连接起来:

RealmConfiguration configDeleteIfNeeded = new RealmConfiguration.Builder(this.getActivity())
                .name("app.realm")
                .setModules(Realm.getDefaultModule(), new AccountModule(), new TripModule())
                .build();

但是Realm.getDefaultModule()始终返回null并抛出错误提供的RealmModule不能为null。我错过了什么? 感谢

更新:就像@ beener的评论一样,解决方法如下:

我在应用程序项目中创建了一个带有虚拟类的虚拟模块,现在getDefaultModule()不为null并且可以正常工作

0 个答案:

没有答案
相关问题