io.realm.exceptions.RealmException: ShoppingItem is not part of the schema for this Realm

I ran into problem at the line below and the error as title.
RealmResults activeItemResults
= realm.where(ShoppingItem.class).equalTo(“completed”, false)
.findAllSorted(“timestamp”, Sort.DESCENDING);

Can you post the code for your ShoppingItem class, please?

import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;

public class ShoppingItem extends RealmObject {

    private String id;
    private String name;
    private String quantity;
    private boolean completed;
    private long timestamp;  // make type long for easier to handle

    public String getId() {
        return id;

    public void setId(String id) { = id;

    public String getName() {
        return name;

    public void setName(String name) { = name;

    public String getQuantity() {
        return quantity;

    public void setQuantity(String quantity) {
        this.quantity = quantity;

    public boolean isCompleted() {
        return completed;

    public void setCompleted(boolean completed) {
        this.completed = completed;

    public long getTimestamp() {
        return timestamp;

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
} // end class

The class seems fine. Check your gradle configuration.
The ordering rules of applying plugins; try to put:
apply plugin: ‘realm-android’
at the very end, after all others “apply-plugin” statements.

Also try to Build->Clean Project and then Build->Rebuild Project especially if you modified Model classes.

an error when sync after

wonder if in the tutorial video that he left out something that he not mentioned in the Realm set up. Because otherwise, it looks straight forward on the videos.

See this:

Error fixed by the two line below in build.gradle (Module: app)

implementation 'io.realm:realm-android:0.87.5'
annotationProcessor 'io.realm:realm-android:0.87.5'