-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on android 12 on take backup of database #6028
Comments
Hi @AsifAliJohari thanks for reporting this. What kind of file system is the external storage directory located on? Does the code work if you use a different file system? |
@AsifAliJohari It looks like you are hitting the new security restrictions introduced in Android 11 which require you to use the Scoped Storage API's: https://developer.android.com/about/versions/11/privacy/storage These API's prevent Realm from opening and using Realm files on external storage directly. |
Sorry for the late reply. But file copy to that path where i want to copy
means in my backup directory ..
i open it in realm studio. so why it crash?
if its problem of android, file should not be copy in my output path .
scope storage issue . given code you can use to reproduce crash .
…On Mon, Nov 14, 2022, 10:26 PM Christian Melchior ***@***.***> wrote:
@AsifAliJohari <https://github.com/AsifAliJohari> It looks like you are
hitting the new security restrictions introduced in Android 11 which
require you to use the Scoped Storage API's:
https://developer.android.com/about/versions/11/privacy/storage
These API's prevent Realm from opening and using Realm files on external
storage directly.
This was also reported here #4777
<#4777> and here #5107
<#5107>
—
Reply to this email directly, view it on GitHub
<#6028 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGOLAQZQ3NQO4WST7RLKCPDWIJY2HANCNFSM6AAAAAAR6GDWRI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It seems like there is little we can do to solve this. @AsifAliJohari not sure why you closed and reopened. Do you have further questions before we close this issue? |
No, it doesn't.
…On Wed, Nov 23, 2022, 9:25 PM Jørgen Edelbo ***@***.***> wrote:
It seems like there is little we can do to solve this. @AsifAliJohari
<https://github.com/AsifAliJohari> not sure why you closed and reopened.
Do you have further questions before we close this issue?
—
Reply to this email directly, view it on GitHub
<#6028 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGOLAQZKJLKGUNBIQR2B5PTWJZAO3ANCNFSM6AAAAAAR6GDWRI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I first copy to cashe dir , then copy to Android/media directory. yes ,
you need to work on it .
Actually, I closed it , mistakenly it reopen .it smilar to other above
mention issue. seniaro diff .
…On Thu, Nov 24, 2022, 10:58 AM Asif Johari ***@***.***> wrote:
No, it doesn't.
On Wed, Nov 23, 2022, 9:25 PM Jørgen Edelbo ***@***.***>
wrote:
> It seems like there is little we can do to solve this. @AsifAliJohari
> <https://github.com/AsifAliJohari> not sure why you closed and reopened.
> Do you have further questions before we close this issue?
>
> —
> Reply to this email directly, view it on GitHub
> <#6028 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AGOLAQZKJLKGUNBIQR2B5PTWJZAO3ANCNFSM6AAAAAAR6GDWRI>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
Ok, I will then close this issue. You can open another, if you have a different problem. |
SDK and version
SDK : java kotlin ? (Cocoa, Java, etc)
Version: 10.9.0
Observations
Crash log / stacktrace
/tmp/realm-java/realm/realm-library/src/main/cpp/realm-core/src/realm/util/file.cpp:1028: [realm-core-11.7.0] Assertion failed: r == 0 && "File::unlock()" with (r, (*__errno())) = [-1, 38]
!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
2022-11-12 12:09:24.070 13729-13729 libc myapp A Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13729 (myapp), pid 13729 (myapp)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A Cmdline: myapp
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A pid: 13729, tid: 13729, name: myapp >>> myapp <<<
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #1 pc 00000000006391f4 /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #2 pc 00000000006392c8 /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #3 pc 000000000063967c /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #4 pc 00000000006283e8 /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #5 pc 00000000006264b4 /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #6 pc 0000000000565704 /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #7 pc 000000000041e9c4 /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #8 pc 000000000039c22c /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!librealm-jni.so (Java_io_realm_internal_OsSharedRealm_nativeWriteCopy+116) (BuildId: 9dec3713d9a47b404a31a57c3c82d771d45b946e)
2022-11-12 12:09:25.130 13962-13962 DEBUG pid-13962 A #15 pc 000000000049998a [anon:dalvik-classes.dex extracted in memory from /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk] (io.realm.internal.OsSharedRealm.writeCopy+78)
2022-11-12 12:09:25.131 13962-13962 DEBUG pid-13962 A #21 pc 00000000004d2264 [anon:dalvik-classes19.dex extracted in memory from /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!classes19.dex] (io.realm.BaseRealm.writeCopyTo+16)
2022-11-12 12:09:25.131 13962-13962 DEBUG pid-13962 A #27 pc 00000000004f3010 [anon:dalvik-classes19.dex extracted in memory from /data/app/~~J2AbeBBneUl9OgNjEY3RaA==/myapp-rOsSiFXlvV9Mex_xdgaLjQ==/base.apk!classes19.dex] (io.realm.Realm.writeCopyTo+0)
2022-11-12 12:09:25.131 13962-13962 DEBUG pid-13962 A #33 pc 0000000000005e6a /data/data/myapp/code_cache/.overlay/base.apk/classes7.dex (myapp.app.data.local.db.RealmBackupRestore.backup+266)
2022-11-12 12:09:25.131 13962-13962 DEBUG pid-13962 A #39 pc 000000000000e48a /data/data/myapp/code_cache/.overlay/base.apk/classes8.dex (myapp.app.ui.other.MoreFragment.onViewCreated$lambda-11+50)
2022-11-12 12:09:25.131 13962-13962 DEBUG pid-13962 A #42 pc 000000000000d6c4 /data/data/myapp/code_cache/.overlay/base.apk/classes8.dex myapp.app.ui.other.MoreFragment.$r8$lambda$eTiY7XCYZA0pIvBO0CbKvojI6Pk+0)
2022-11-12 12:09:25.131 13962-13962 DEBUG pid-13962 A #45 pc 000000000000cad4 /data/data/myapp/code_cache/.overlay/base.apk/classes8.dex (myapp.app.ui.other.MoreFragment$$ExternalSyntheticLambda9.onClick+8)
Steps & Code to Reproduce
fun backup(UserIDnumber: String?) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "realm$realm")
Log.d(TAG, "Realm.getDefaultInstance()" + Realm.getDefaultInstance())
}
var exportRealmFile: File? = null
// File exportRealmPATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
val exportRealmPATH =
File("${if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) context.externalMediaDirs.firstOrNull()?.path?: context.getExternalFilesDir(null) else Environment.getExternalStorageDirectory().path}/myapp/Backup/")
The text was updated successfully, but these errors were encountered: