Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Debugging - Java SDK

On this page

  • Android Studio Debugging
  • NDK Debugging


The Android Studio debugger can provide misleading values for Realm object fields. For correct values, you can watch accessor values instead, or use the Realm object toString() method to see the latest field values.

This section details information you should keep in mind when debugging Realm applications with Android Studio to avoid incorrect value reporting. When you watch a Realm object, you'll see values displayed in the object's fields. These values are incorrect because the field values themselves are not used. This is because Realm creates a proxy object behind the scenes, overriding the getters and setters to access the persisted data in the realm. To see the correct values, add a watch on the accessors. See the image below:

When using the Android Studio debugger, accessors display the correct field value, while fields show outdated information.

In the image above, the debugger has stopped on line 113. There are three watch values:

  • The person variable

  • The person.getName() accessor

  • The person.getAge() accessor

The code from lines 107 to 111 alters the person instance by changing the name and age in a write transaction. On line 113, the person watch instance reports incorrect values for the field watch values. The watch values that use the accessors report values that are correct.

The Realm Java SDK library contains native code. Debugging NDK crashes can be cumbersome, as the default stack trace provides minimal information.

We recommend you use a crash reporting tool such as Crashlytics. This gives you the ability to track native errors and gather other valuable information. We can help with your issues faster if you have this information.

To enable NDK crash reporting in Crashlytics for your project, add the following to the root of your application build.gradle file:

crashlytics {
enableNdk true


The values androidNdkOut and androidNdkLibsOut are not needed.


Log Realm Events