Android Studio 3.2. Realm: 4.1.0
In my build.gradle:
buildscript {
ext.REALM_VERSION = '4.1.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "io.realm:realm-gradle-plugin:$REALM_VERSION"
}
}
In my app/build.gradle:
implementation 'io.realm:android-adapters:2.0.0'
Here snippet:
RealmQuery<Merchant> realmQuery = realm.where(Merchant.class);
return realmQuery.findAllSorted(sortByFieldName, Sort.ASCENDING);
And this code success work. Nice.
But when I upgrade Realm to 5.8.0 I get compile error:
Error:
error: cannot find symbol
return realmQuery.findAllSorted(sortByFieldName, Sort.ASCENDING);
realmQuery.findAllSorted(sortByFieldName, Sort.ASCENDING)
Is replaced by
realmQuery.sort(sortByFieldName, Sort.ASCENDING).findAll()
since 5.0.0
See change log:
5.0.0 (2018-03-15)
Breaking Changes
The OrderedCollectionChangeSet parameter in OrderedRealmCollectionChangeListener.onChange() is no longer nullable. Use changeSet.getState() instead (#5619).
realm.subscribeForObjects() have been removed. Use
RealmQuery.findAllAsync(String subscriptionName)
andRealmQuery.findAllAsync()
instead.Removed previously deprecated RealmQuery.findAllSorted(), RealmQuery.findAllSortedAsync(), RealmResults.distinct() and RealmQuery.distinctAsync(). Use
RealmQuery.sort()
andRealmQuery.distinct()
instead.
Please note that this change also demands updating to realm-android-adapters 3.0.0
.
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