realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

An error occurred initializing a Realm Error :io.realm.exceptions.RealmError: Unrecoverable error. Permission denied in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 107 #7784

Closed 15239545925 closed 1 year ago

15239545925 commented 1 year ago

How frequently does the bug occur?

Always

Description

Call Realm.getDefaultInstance() on initialization; It will crash and error initialize if you comment it out and call Realm.getDefaultInstance() when using the database; Errors are also reported

Use version : classpath "io.realm:realm-gradle-plugin:10.10.0" classpath "io.realm:realm-gradle-plugin:10.0.1"

Stacktrace & log output

The error information is as follows:
2023-03-09 18:01:47.844 10436-10436/com.jc.scale E/CrashReport: io.realm.exceptions.RealmError: Unrecoverable error. Permission denied in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 107
at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(Native Method)
at io.realm.internal.OsSharedRealm.(OsSharedRealm.java:175)
at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:251)
at io.realm.BaseRealm.(BaseRealm.java:137)
at io.realm.BaseRealm.(BaseRealm.java:104)
at io.realm.Realm.(Realm.java:163)
at io.realm.Realm.createInstance(Realm.java:499)
at io.realm.RealmCache.createInstance(RealmCache.java:507)
at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:473)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:414)
at io.realm.Realm.getDefaultInstance(Realm.java:407)
at com.jc.scale.App.onCreate(App.java:109)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6765)
at android.app.ActivityThread.access$1600(ActivityThread.java:253)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2090)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7881)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

Can you reproduce the bug?

Always

Reproduction Steps

Recirculation step:Application open system permissions will crash, do not open system permissions can be used normally

Version

classpath "io.realm:realm-gradle-plugin:10.10.0" classpath "io.realm:realm-gradle-plugin:10.0.1"

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

AndroidStudio

Build environment

Android Studio version: ... Android Studio 4.2 Android Build Tools version: ... 31 Gradle version: ...6.1.1

15239545925 commented 1 year ago

The Application initialization code is as follows: Realm.init(this); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder() .name("scaleSys.realm") .allowQueriesOnUiThread(true) .allowWritesOnUiThread(true) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration);

            realm = Realm.getDefaultInstance();
cmelchior commented 1 year ago

Hi @15239545925

That setup should work fine. Can you describe your setup in more detail? Are you reproducing this on a real device, in that case, which one? If it is on an emulator, which one and on which operating system?

github-actions[bot] commented 1 year ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.