explaingit

realm/realm-java

11,473JavaAudience · developerComplexity · 4/5Setup · hard

TLDR

A mobile database for Android that stores data as objects your Java code reads and writes directly, with optional real-time sync across devices. Now deprecated, new projects should use the Realm Kotlin SDK instead.

Mindmap

mindmap
  root((Realm Java))
    What it does
      Object storage
      Thread-safe queries
      Device sync
    Key Features
      No SQL needed
      Built-in encryption
      Object relationships
    Deprecation
      Sunset Sept 2024
      Use Kotlin SDK
    Audience
      Android developers
      Legacy app teams
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Store and query app data on Android devices as plain Java objects without writing SQL.

USE CASE 2

Sync data in real time across multiple Android devices without writing custom server sync code.

USE CASE 3

Maintain an existing Android app that already uses the Realm Java SDK.

USE CASE 4

Add built-in encryption to locally stored app data on Android.

Tech stack

JavaAndroidGradleCMakeC++

Getting it running

Difficulty · hard Time to first run · 1day+

Requires JDK 8, Android Studio, CMake, NDK, and multiple environment variables. Full build can take over an hour. SDK is deprecated, not recommended for new projects.

In plain English

Realm is a mobile database built to run directly on Android phones, tablets, and wearables. Unlike traditional databases that store data in tables and require a translation layer to work with your code, Realm stores data as objects that your app can read and write directly. The goal was to make storing and retrieving data on a mobile device feel simpler and faster than the alternatives. The Java version of Realm targets Android exclusively. You define your data as plain Java classes, and Realm handles the storage. There is no separate query language to learn: you filter and sort data using regular Java code. The library also handles thread safety automatically, so you do not have to write extra locking code when reading data on one thread while writing on another. Encryption and relationships between data objects are built in. One notable feature documented in the README is Device Sync, which keeps data synchronized in real time across multiple devices and a cloud backend. This means that if a user updates something on one phone, other devices see the change without any custom server code on your part. The sync backend was provided by MongoDB Atlas. It is worth knowing upfront that MongoDB announced the deprecation of the Atlas Device Sync service and all Realm SDKs in September 2024. This Java SDK is no longer actively developed. For new Android projects, the README directs developers to the Realm Kotlin SDK instead, which supports both Android and Kotlin Multiplatform. The Java SDK remains available for teams maintaining existing apps, but starting a new project on it is not recommended. If you still need to build from source, the README lists a fairly involved setup: JDK 8, Android Studio, specific Android SDK build tools, CMake, the NDK, and several environment variables. The Gradle build command assembles all the necessary components, though the README notes the full build can take an hour or more.

Copy-paste prompts

Prompt 1
I have an Android app using SQLite. Show me how to migrate a simple user profile table to Realm Java, including the model class and basic read and write operations.
Prompt 2
How do I set up Realm Java in an Android project with Gradle, define a data model, and write and read objects from the database?
Prompt 3
My Android app uses Realm Java and I need to query objects by a field value with a sort order. Show me the Java code.
Prompt 4
I am maintaining an old Android app that uses Realm Java. What do I need to know about its deprecation, and what is the path to migrate to the Realm Kotlin SDK?
Open on GitHub → Explain another repo

← realm on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.