Realm.io无法使示例工作 [英] Realm.io can't get examples to work
问题描述
我无法开始使用Realm.io,我已经在自己的项目以及IntroExample中对其进行了尝试.
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:读取事务期间的可变方法调用.
java.lang.IllegalStateException: Mutable method call during read transaction.
当我尝试存储东西时,我得到:
When i try to store something, i get:
io.realm.exceptions.RealmException:找不到生成的代理 课
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'
}
推荐答案
答案的组合 https://stackoverflow.com/a/26294208/1251958 并回答 https://stackoverflow.com/a/26326314/1251958 会成功
A combination of answer https://stackoverflow.com/a/26294208/1251958 and answer https://stackoverflow.com/a/26326314/1251958 leads to success.
添加了@RealmClass
注释@Philluxx后,我在AndroidStudio中遇到错误,指出了@ChristianMelchior提到的必需语法
After adding the @RealmClass
annotation @Philluxx metioned, i got errors in AndroidStudio pointing out the required syntax as mentioned by @ChristianMelchior
注意:您可能必须清除应用程序数据,因为忽略其中的任何一项似乎都会导致数据库损坏,从而导致随后的崩溃.
Note: You will probably have to clear the app data as neglecting to do either seems to lead to a corrupted database that leads to subsequent crashes.
这篇关于Realm.io无法使示例工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!