Reputation: 1005
Hi i have a android project that use another android project as a module. I used realm for offline data storage. both the project uses realm data base. when i try to run the project it shows error.
class RealmModel is not part of the schema for this Realm
i used this link to fix that error
In that above url, they asked to create RealmModule class with @RealmModule annotation. This is my class,
@RealmModule
public class MessageRealmModule implements RealmModule {
@Override
public boolean library() {
return true;
}
@Override
public boolean allClasses() {
return false;
}
@Override
public Class<?>[] classes() {
return new Class<?>[0];
}
@Override
public Class<? extends Annotation> annotationType() {
return null;
}
}
After this line got this error.
java.lang.IllegalArgumentException: com.anubavam.message.MessageRealmModule is not a RealmModule. Add @RealmModule to the class definition.
Upvotes: 2
Views: 2954
Reputation: 20126
No, you need to do it in the annotation parameters like so:
@RealmModule(library = true, classes = { MyModelClass.class })
public class MessageRealmModule {
}
See also https://realm.io/docs/java/latest/#schemas
Upvotes: 4