Install Realm - Java SDK
On this page
Note
Java SDK in Maintenance Mode
The Java SDK is in best-effort maintenance mode and no longer receives new development or non-critical bug fixes. To develop your app with new features, use the Kotlin SDK. You can use the Java SDK with the Kotlin SDK in the same project.
Learn more about how to Migrate from the Java SDK to the Kotlin SDK.
Overview
This page details how to install Realm using the Java SDK in your project and get started.
You can use multiple SDKs in your project. Because the Java SDK is no longer receiving new development, this is useful if you want to use new features in your app. For example, you can add Atlas Device Sync's Data Ingest feature to your app using the Kotlin SDK while continuing to use Java for everything else.
Prerequisites
Android Studio version 1.5.1 or higher.
Java Development Kit (JDK) 11 or higher.
An emulated or hardware Android device for testing.
Android API Level 16 or higher (Android 4.1 and above).
Installation
Realm only supports the Gradle build system. Follow these steps to add the Realm Java SDK to your project.
Note
ProGuard
Because Realm provides a ProGuard configuration as part of the Realm library, you do not need to add any Realm-specific rules to your ProGuard configuration.
Project Gradle Configuration
To add local-only Realm to your application, make
the following changes to your project-level Gradle build
file, typically found at <project>/build.gradle
:
Application Module Gradle Configuration
Then, make the following changes to your application-level
Gradle build file, typically found at <project>/app/build.gradle
:
After updating the build.gradle
files, resolve the dependencies by
clicking File > Sync Project with Gradle Files.
Enable Atlas Device Sync
To use Atlas Device Sync in your application, create a realm
block in your
application module build.gradle
. Within this block, set syncEnabled
to true
.
realm { syncEnabled = true }
Supported Platforms
Realm's Java SDK enables you to build apps for the following platforms:
Android
Wear OS
Android Automotive OS
Android TV
Android Things