问题描述
当我要将领域数据库保存在本地内部存储中时,该应用程序在Android 11上崩溃。该应用程序可以在所有其他版本上运行,但今天我将其应用程序更新为android 11,并且崩溃了。
E/AndroidRuntime: FATAL EXCEPTION: main
Process: PID: 7882
io.realm.exceptions.RealmError: Unrecoverable error. open() Failed: Operation not permitted in io_realm_internal_Group.cpp line 210
at io.realm.internal.Group.nativeWritetoFile(Native Method)
private Realm realm;
try {
File file = new File(folderPath);
if (!file.exists()) {
file.mkdir();
}
realm = new File(file,fileName);
if (realm .exists()) {
realm .delete();
}
realm.writecopyTo(realm ); // crashing here in this line
} catch (IOException e) {
e.printstacktrace();
}