I'm failing to get started with Realm.io, I've tried it in my own project aswell as with the IntroExample.
When i try to look up something, i get:
java.lang.IllegalStateException: Mutable method call during read transaction.
When i try to store something, i get:
io.realm.exceptions.RealmException: Could not find the generated proxy class
I seem to have a fundamental flaw somewhere.
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "lorem.ipsum"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.jsoup:jsoup:1.8.+'
compile 'io.realm:realm-android:0.71.0'
}
Make a @RealmClass
annotation to your model class. I struggled with the same problem and went a bit deeper in the proxy class generation of Realm. Only classes with the @RealmClass annotation are generated.
@RealmClass
public class Category extends RealmObject {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
I tried to run your example code and got a lot of exceptions regarding your model class. It looks like your getters and setters have been renamed from the default, which currently breaks the annotation processor.
I tried to change the model class to:
public class DataItem extends RealmObject {
private String uuid;
private String content;
private boolean bool;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isBool() {
return bool;
}
public void setBool(boolean bool) {
this.bool = bool;
}
}
which seemed to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With