Android and iOS Access to invalidated Collection object

Apps keep on crashing because of Access to invalidated Collection object
How do i check if the object has been invalidated.

if (realmObject != null){. —> crashing over here


What SDK are you using and do you have a crash log/exception message that you can share?

1 Like

So we have the Chat functionality and users can delete the chat. When one user deletes the chat, it will not be visible to other user. Issues occurs when one user deletes the chat and the 2nd is still on that screen

classpath “io.realm:realm-gradle-plugin:10.8.0”

2021-09-13 01:13:09.112 6565-6565/ E/REALM_JNI: jni: ThrowingException 9, Access to invalidated Collection object, .
2021-09-13 01:13:09.112 6565-6565/ E/REALM_JNI: Exception has been thrown: Access to invalidated Collection object
2021-09-13 01:13:09.113 6565-6565/ D/AndroidRuntime: Shutting down VM
2021-09-13 01:13:09.116 6565-6565/ E/AndroidRuntime: FATAL EXCEPTION: main
Process:, PID: 6565
java.lang.IllegalStateException: Access to invalidated Collection object
at io.realm.internal.OsList.nativeSize(Native Method)
at io.realm.internal.OsList.size(
at io.realm.ManagedListOperator.size(
at io.realm.RealmList.size(
at butterknife.internal.DebouncingOnClickListener.onClick(
at android.view.View.performClick(
at android.view.View.performClickInternal(
at android.view.View.access$3600(
at android.view.View$
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)

Apps keep on crashing because of Access to invalidated Collection object.

Is that a question? Are you having the same issue? The OP’s issue was likely due to the client not observing changes in Realm. So when a Realm object was deleted on one client the other client didn’t know about it so when attempting to modify a deleted object, the error was thrown.

If you have a question or a problem with your code, perhaps opening a different thread or posting a question on StackOverflow with more details would help us to help you.

1 Like