我在Android中使用Realm,它很有用。但有时在应用开始时会收到这些错误:
错误-1:
Exception io.realm.exceptions.RealmFileException: Too many open files () (/data/data/[REDACTED_DOMAIN_NAME]/files/e_app.realm) in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 91
io.realm.internal.SharedRealm.nativeGetSharedRealm (SharedRealm.java)
io.realm.internal.SharedRealm.<init> (SharedRealm.java:180)
io.realm.internal.SharedRealm.getInstance (SharedRealm.java:227)
io.realm.BaseRealm.<init> (BaseRealm.java:124)
io.realm.BaseRealm.<init> (BaseRealm.java:93)
io.realm.Realm.<init> (Realm.java:150)
io.realm.Realm.createInstance (Realm.java:417)
io.realm.RealmCache.doCreateRealmOrGetFromCache (RealmCache.java:348)
io.realm.RealmCache.createRealmOrGetFromCache (RealmCache.java:281)
io.realm.Realm.getDefaultInstance (Realm.java:325)
com.app.android.dao.RealmEncryptionHelper.createEncryptedRealm (RealmEncryptionHelper.java:47)
com.app.android.dao.RealmController.getRealm (RealmController.java:104)
com.app.android.dao.RealmController$1.run (RealmController.java:48)
java.lang.Thread.run (Thread.java:762)
错误-2:
Exception io.realm.exceptions.RealmError: Unrecoverable error. Too many open files in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 91
io.realm.internal.SharedRealm.nativeGetSharedRealm ()
io.realm.internal.SharedRealm.<init> ()
io.realm.internal.SharedRealm.getInstance ()
io.realm.internal.SharedRealm.getInstance ()
io.realm.ca.b ()
io.realm.ca.a ()
io.realm.by.l ()
com.app.android.dao.a.a ()
com.app.android.MyApplication.e ()
com.app.android.e.a.b ()
com.app.android.e.a$1.onMessage ()
okhttp3.internal.ws.RealWebSocket.onReadMessage ()
okhttp3.internal.ws.WebSocketReader.readMessageFrame ()
okhttp3.internal.ws.WebSocketReader.processNextFrame ()
okhttp3.internal.ws.RealWebSocket.loopReader ()
okhttp3.internal.ws.RealWebSocket$2.onResponse ()
okhttp3.RealCall$AsyncCall.execute ()
okhttp3.internal.NamedRunnable.run ()
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:818)
错误-3:
Exception java.lang.IllegalStateException: Realm at path '/data/data/[REDACTED_DOMAIN_NAME]/files/e_app.realm' already opened with different schema version.
io.realm.internal.SharedRealm.nativeGetSharedRealm ()
io.realm.internal.SharedRealm.<init> ()
io.realm.internal.SharedRealm.getInstance ()
io.realm.h.<init> ()
io.realm.h.<init> ()
io.realm.by.<init> ()
io.realm.by.a ()
io.realm.ca.b ()
io.realm.ca.a ()
io.realm.by.l ()
com.app.android.dao.a.a ()
com.app.android.dao.a$1.run ()
java.lang.Thread.run (Thread.java:818)
我认为这些错误相互关联。每次开始我都不会遇到错误。但有些设备会出现这种错误,我认为这与设备无关。 没有改变Realm的架构版本。我有这个错误。