Questions tagged [realm-java]
99 questions
11
votes
1 answer
Realm Java Migration: Property has been made required
Works fine for most fresh installs, but a lot of reports are coming in with this issue after the latest app update. It has been awhile between updates, so I THINK this could be caused by users updating from a very old version before I added…

zngb
- 601
- 1
- 7
- 24
6
votes
2 answers
Using Realm with Gson
I have json with field _id
String json = "{ _id : 1, name : 'Alex', role: 'admin' }"
In my Realm model I use @SerializedName attribute:
public class User extends RealmObject {
@SerializedName("_id")
@PrimaryKey
private int id;
…

Alexandr
- 1,891
- 3
- 32
- 48
5
votes
1 answer
Android Studio 3.0 error: android-apt is incompatible
I'm new to Android development and got a legacy project. So I installed the newest version of Android Studio and opened it.
When I try to build it, I get this error:
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please…

Renan Vasconcelos
- 166
- 2
- 17
5
votes
2 answers
Is it possible to query several fields containing a list of string values (Realm Java)
I am trying to query several fields at the same time that contains a list of string values in Realm.
Lets say that I have the following Object:
public class Article extends RealmObject implements Serializable{
@PrimaryKey
@Required
…

user274051
- 325
- 1
- 12
5
votes
1 answer
Realm Java Android: Create or update object
In Realm Javascript, it's possible to create an object by primary key and, if it already exists, update the existing object: https://realm.io/docs/javascript/latest/#creating-and-updating-objects-with-primary-keys
How can I achieve the same in Realm…

Damnum
- 1,839
- 16
- 35
5
votes
1 answer
RealmError: Realm Out of memory size
I am using Realm 3.0.0 as the DB of my Android app. It's like a questionnaire application, in which the user navigates inside the app a lot. When I use the app (go back and forth) continuously, I get the following error:
Fatal Exception:…

Mehmet K
- 2,805
- 1
- 23
- 35
4
votes
2 answers
How to Close() all the instances of the Realm before deleting its file
I got the java.lang.IllegalStateException while trying to delete the realm file.
java.lang.IllegalStateException: It's not allowed to delete the file associated with an open Realm. Remember to close() all the instances of the Realm before deleting…

NamNH
- 1,752
- 1
- 15
- 37
3
votes
0 answers
Android Studio 4.2 throws a null pointer exception on incremental builds
UPDATE #4:
I have updated to Android Studio 4.2.1 and Realm 10.5.0 and the problem still occurs. Same line numbers on the exception as below.
UPDATE #3:
Looking at the full stack trace (which you can see here), it appears this is an issue with…

tfrysinger
- 1,306
- 11
- 26
3
votes
1 answer
Do I need a migration to change type Int to Long?
There is a birthday field in my RealmObject class which is a type of Int?. I need to change this field's type to Long?. I don't know whether I would need a migration or not.
From realm docs :
The integer types byte, short, int, and long are all…

Ergin Doğan Yıldız
- 81
- 5
3
votes
2 answers
Cannot delete Realm User
I login to Realm by SyncCredentials allow create User as code below:
SyncCredentials credentials = SyncCredentials.usernamePassword(username, password, true);
SyncUser.logInAsync(credentials, AUTH_URL, new SyncUser.Callback() {
}
And…

Ben Jima
- 677
- 5
- 10
3
votes
1 answer
I'm using realm DB and it has no Foreign keys .. is there any alternative solution?
guys i'm working on a android project for my DB course and i'm using realm DB but the problem is that i just found that realm has no foreign keys(realm is NOT a relational DB) so i was wondering if there is any other solution to use as a foreign…

abdullah
- 157
- 2
- 8
3
votes
2 answers
Update specific realm model properties?
How to update only some realm model properties and instead of trying to save complete realm model again and again using copyToRealmOrUpdate().
public class User extends RealmObject {
@PrimaryKey
public String id =…

Anurag Singh
- 6,140
- 2
- 31
- 47
3
votes
1 answer
Realm String greaterThan
Is there any way to find all (or just the next) RealmObjects with Strings lexicographically greater than the target?
Something like
MyEntry next = realm.where(MyEntry.class)
.greaterThan("name", current)
.findAllSorted("name")
…

serv-inc
- 35,772
- 9
- 166
- 188
3
votes
2 answers
Writing to Realm on main thread.
Is it ok to write to Realm on the main thread?
Basically I'd like to write some ObjectA to Realm right before starting ActivityA.
Once ActivityA starts it needs immediate access (in onCreate) to ObjectA - can I also read on the main…

b.lyte
- 6,518
- 4
- 40
- 51
2
votes
2 answers
How to move to Realm Sync Protocol Version 3 for Android?
I am new to Realm and Android development and am trying to query a document from Atlas. I am able to successfully authenticate users, but when I try to perform a query, I get the following error: E/REALM_JAVA: Session…

Deepti V.
- 21
- 1