Realm Blog

Realm Java 0.81.1

We just released a Realm Java update to this website and to Maven. This release includes Kotlin support, new library support, and easier Realm configuration, as well as a some performance improvements.

Simplified setup

We have simplified the setup of a Realm instance, which can be done once by creating a RealmConfiguration object. This object can be saved as a default configuration, so you don’t have to keep a reference to your Android Context whenever you want to access a Realm.

RealmConfiguration makes it easy to control the version of your Realm, and if required, it will automatically trigger any migration code.

// Setup
RealmConfiguration realmConfig = new RealmConfiguration.Builder(context)
	.migration(new MyMigration())


// Getting a realm instance
Realm realm = Realm.getDefaultInstance();
Realm realm = Realm.getInstance(realmConfig);

See our documentation on configuring a Realm for further details.

Note: This means we have deprecated most of the old constructors. They will be removed in the next minor release.

Custom schemas and libraries

With RealmModule, Realm now fully supports using Realm model classes from other libraries, as well as making custom schemas for your Realm. This is done by annotating a class with the new @RealmModule annotation and adding it to your RealmConfiguration.

@RealmModule(classes = { Person.class, Dog.class })
public class MyModule {

RealmConfiguration realmConfig = new RealmConfiguration.Builder(context)
	.setModules(new MyModule())

This change means that ProGuard can now fully obfuscate all Realm model classes.

See our documentation on schemas for further details, including some of particular note for library authors.

Kotlin support

Realm is now compatible with Kotlin (M12+). See our Kotlin example for more details on how to set this up. Thank you to @cypressious for providing this.

Performance and bug fixes

We have tuned the performance when iterating RealmResults in tight loops, as well as general performance for accessing data in your Realm. This means you should see decreased memory usage and increased speed when reading or writing data to Realm.

Alongside the headline improvements, we have also fixed a number of smaller bugs. See the full changelog for details.

Thanks for reading. Now go forth and build amazing apps with Realm! As always, we’re around on the mailing list, Stack Overflow, GitHub, and Twitter.

Realm Team

At Realm, our mission is to help developers build better apps faster. We provide a unique set of tools and platform technologies designed to make it easy for developers to build apps with sophisticated, powerful features — things like realtime collaboration, augmented reality, live data synchronization, offline experiences, messaging, and more.

Everything we build is developed with an eye toward enabling developers for what we believe the mobile internet evolves into — an open network of billions of users and trillions of devices, and realtime interactivity across them all.

Get more development news like this