当我将领域数据库本地存储在文件夹中时,我的应用程序在 android 11 崩溃?
My App is crashing on android 11 when I store realm database locally in a folder?
当我要在本地内部存储中保存领域数据库时,应用程序在 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();
}
当我要在本地内部存储中保存领域数据库时,应用程序在 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();
}