尝试访问RealmObject时,Realm类崩溃

时间:2016-01-18 14:14:52

标签: android database class schema realm

当我尝试获取Realm对象时,我收到此警报:

01-18 15:09:51.687: E/AndroidRuntime(21446): io.realm.exceptions.RealmException: class nl.hgrams.passenger.client.UserRecord is not part of the schema for this Realm.

从这里进入:

 realm.beginTransaction();
 realm.where(UserRecord.class).findAll().clear();
 realm.commitTransaction();

甚至:

 RealmResults<UserRecord> completed = realm.where(UserRecord.class).equalTo("id", userId).findAll();

我在这里做错了什么? 这是我的班级:http://pastebin.com/mX5yuV1U

这是我的build.gradle文件:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'http://archiva.instabug.com/repository/release' }
    maven { url 'http://dl.bintray.com/amulyakhare/maven' }
    maven { url 'https://jcenter.bintray.com/' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url 'https://jcenter.bintray.com/' }
}


android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 448
    versionName '2.1'
    multiDexEnabled true
}
lintOptions {
    checkReleaseBuilds false
    abortOnError false
}
dexOptions {
    preDexLibraries = false
    javaMaxHeapSize "4g"
}
packagingOptions {
    exclude 'META-INF/services/javax.annotation.processing.Processor'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
}
buildTypes {
    release {
        ext.enableCrashlytics=true
        ext.betaDistributionReleaseNotesFilePath="/Users/gopublic/bamboo-home/xml-data/build-dir/131073/PAS-PAD-VRANDROID/changelog.txt"
        ext.betaDistributionEmails="alin.rosu@100grams.nl, pedro.amanhui@100grams.nl, 100gramstest@gmail.com"
        ext.betaDistributionGroupAliases="passenger-android-beta"

    }

    debug{
        ext.enableCrashlytics=true
        ext.betaDistributionEmails="alin.rosu@100grams.nl, pedro.amanhui@100grams.nl, 100gramstest@gmail.com"
        ext.betaDistributionReleaseNotesFilePath="/Users/gopublic/bamboo-home/xml-data/build-dir/131073/PAS-PAD-VRANDROID/changelog.txt"
        ext.betaDistributionGroupAliases="passenger-android-beta"

    }
}
}

dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.google.code.gson:gson:2+'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.jakewharton:butterknife:4.0.+'
compile 'com.squareup.okhttp:okhttp:2.0.0+'
compile 'com.google.android.gms:play-services-maps:+'
compile 'com.google.android.gms:play-services-location:+'
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
compile 'com.tonicartos:stickygridheaders:1.0.1@jar'
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/gcm.jar')
compile files('libs/okhttp-urlconnection-2.0.0.jar')
compile project(':libraries:facebook')
compile 'com.edmodo:cropper:1.0.1'
compile 'com.squareup.picasso:picasso:2.3.3'
compile 'com.makeramen:roundedimageview:1.3.0'
compile 'com.androidplot:androidplot-core:0.6.1'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.instabug.library:instabugsupport:1+'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'io.realm:realm-android:0.87.+'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.plattysoft.leonids:LeonidsLib:1.3.1'
compile('com.crashlytics.sdk.android:crashlytics:2.5.1@aar') {
    transitive = true;
}
compile(
        [group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
        [group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
        [group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
)
compile files('libs/easyandroidanimationslibrary-v0.5.jar')
}

我在Realm 0.87文档中看到了有关proGuard的内容,但我没有使用它。 我的领域类也是这样开始的:

     if (Config == null) {
                Config = new RealmConfiguration.Builder(PSLocationCenter.this).name("myrealm.realm").schemaVersion(3).build();
            }

PS:构建应用程序以在手机上运行时,我在运行控制台中收到此错误:

 Error:org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; cvc-pattern-valid: Value 'build-tools;23.0.0 rc3' is not facet-valid with respect to pattern '[a-zA-Z0-9_\-;.]+' for type 'segmentListType'.

相关吗?

0 个答案:

没有答案