0

I need your help with this error, it's happening to me a lot, it's being generated on the line where I instantiate my realm, I understand that deleting the database file and recreating it could solve it, but how could I do it? this??

Caused by: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.myapp/files/default.realm': Invalid top array (ref: 222488, size: 11)
Exception backtrace:
<backtrace not supported on this platform> Path:Exception backtrace:
<backtrace not supported on this platform>. (Invalid top array (ref: 222488, size: 11)
Exception backtrace:
<backtrace not supported on this platform> Path: 
/data/data/com.myapp/files/default.realm
Exception backtrace:
<backtrace not supported on this platform>) (/data/data/com.myapp/files/default.realm) in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

In this way I establish the instance of my realm

Realm.init( MyApp.instance )

       val config = RealmConfiguration.Builder()
           .deleteRealmIfMigrationNeeded()
           .build()

       realm = Realm.getInstance(config)
Jhonny Luis
  • 216
  • 1
  • 2
  • 5
  • Does this answer your question? [Realm Studio: Unable to open a realm... Invalid top array (ref: 34280, size: 11)](https://stackoverflow.com/questions/60229816/realm-studio-unable-to-open-a-realm-invalid-top-array-ref-34280-size-11) – Gokul Nath KP Oct 14 '22 at 14:29
  • The case mentioned, it is trying to open using the realm-studio, I tried it and it works fine, but my problem is already with the phone when trying to make a query or when opening the app – Jhonny Luis Oct 14 '22 at 14:44

0 Answers0