Android Realm: primary key restriction does not work. Value already exists: 0

I am currently working a lot with Realm. I love it! But one thing that is really annoying is that I cannot set my primary key to zero when using copyToRealmOrUpdate. I am returning my identifier from the server. The first identifier is zero. Therefore my app immediately displays the message: Primary key constraint broken. Value already exists: 0. If it were a different number than just fine, but it drops to zero. Is this a mistake or can someone help me?

Thank!

+4
source share
1 answer

. 0 , . , 0 , API, Realm.createObject(). , , Realm.copyToRealmOrUpdate(), : https://github.com/realm/realm-java/pull/995

, -SNAPSHOT, . :

 repositories {
        jcenter()
        maven {
            url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
        }
    }

    compile 'io.realm:realm-android:0.80.1-SNAPSHOT'
+6

All Articles