Michael Jordan
Michael Jordan

Reputation: 29

How to fix error Could not find class 'io.realm.rx.RealmObservableFactory$2'?

I'm developing an android application with realm using Eclipse. But I am facing an issue. When I Create Object of realm, the following exception occurred at realm.createObject(Product.class).

Can you help me understand why this exception occurred? Is there any thing missing on my side?

Error: Could not find class 'io.realm.rx.RealmObservableFactory$2', referenced from method io.realm.rx.RealmObservableFactory.from

Product product=new Product();
Realm realm = Realm.getInstance(this);
realm.beginTransaction();
realm.createObject(Product.class);
product.setId("1001");
product.setName("John");
realm.commitTransaction();
realm.close();

Product Class object file.

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

 @RealmClass
 public class Product extends RealmObject {
 @PrimaryKey
 String id;
 String name;
 public Product(){
    super();
 }
 public Product(String id, String name){    
    super();
    this.id = id;
    this.name = name; 
 }
public String getId() {
    return id;
}
public void setId(String id) {
    this.id = id;
}   
 public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
}

Thanks,

Upvotes: 1

Views: 1094

Answers (1)

Christian Melchior
Christian Melchior

Reputation: 20126

I'm guessing that Eclipse somehow doesn't gracefully handle the missing Rx.Observable class that is optional to include. Have you tried either of the solutions described here? https://realm.io/docs/java/latest/#jackson-databind

Upvotes: 1

Related Questions