realm-java: Error: Operation not permitted in io_realm_internal_SharedGroup.cpp
Goal
What do you want to achieve?
Actual Results
io.realm.exceptions.RealmError: Unrecoverable error. Operation not permitted in io_realm_internal_SharedGroup.cpp line 113 at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(Native Method) at io.realm.internal.SharedGroup.openSharedGroupOrFail(SharedGroup.java:95) at io.realm.internal.SharedGroup.<init>(SharedGroup.java:74) at io.realm.internal.SharedGroupManager.<init>(SharedGroupManager.java:49) at io.realm.BaseRealm.<init>(BaseRealm.java:81) at io.realm.Realm.<init>(Realm.java:140) at io.realm.Realm.createAndValidate(Realm.java:240) at io.realm.Realm.createInstance(Realm.java:220) at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126) at io.realm.Realm.getDefaultInstance(Realm.java:166) at br.com.jbsoft.mobile.di.modules.ProviderModule.provideRealm(ProviderModule.java:28) at br.com.jbsoft.mobile.di.modules.ProviderModule_ProvideRealmFactory.get(ProviderModule_ProvideRealmFactory.java:19) at br.com.jbsoft.mobile.di.modules.ProviderModule_ProvideRealmFactory.get(ProviderModule_ProvideRealmFactory.java:8) at br.com.jbsoft.mobile.models.ControleUsuario_MembersInjector.injectMembers(ControleUsuario_MembersInjector.java:33) at br.com.jbsoft.mobile.models.ControleUsuario_MembersInjector.injectMembers(ControleUsuario_MembersInjector.java:9) at br.com.jbsoft.mobile.di.components.DaggerProviderComponent.inject(DaggerProviderComponent.java:243) at br.com.jbsoft.mobile.models.ControleUsuario.inject(ControleUsuario.java:31) at br.com.jbsoft.mobile.models.ControleUsuario.getUsuario(ControleUsuario.java:35) at br.com.jbsoft.mobile.views.Main.onCreate(Main.java:59) at br.com.jbsoft.mobile.componentes.BaseActivity.onCreate(BaseActivity.java:86) at android.app.Activity.performCreate(Activity.java:6500) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218) at android.app.ActivityThread.access$1000(ActivityThread.java:198) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6837) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Steps & Code to Reproduce
Just start the application and get the exception :[
Code Sample
My config
RealmConfiguration configuration = new RealmConfiguration
.Builder(this, new File(getCaminhoDB(Boolean.FALSE)))
.name(Constantes.arquivos.DB_REALM_FINAL)
.encryptionKey(Preferencias.getInstance().getDbk())
.schemaVersion(BuildConfig.DB_VERSION)
.modules(new InitialVersion())
.migration(new MigrationDB())
.build();
Realm.setDefaultConfiguration(configuration);
RealmLog.add(new DebugAndroidLogger());
and getCaminhoDB:
private static String getCaminhoDB(@NonNull Context context) {
if (isExternalStorageWritable()) {
return context.getExternalFilesDir("database").toString();
} else {
return context.getFilesDir().getAbsolutePath();
}
}
getKeyDef():
public static byte[] getKeyDef() {
byte[] key = new byte[64];
String s = "***********************************************************************";
try {
new SecureRandom(s.getBytes("us-ascii")).nextBytes(key);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return key;
}
Version of Realm and tooling
Realm version(s): 1.1.0
Android Studio version: 2.1.2
Which Android version and device: I test with Emulator (Android 6.0) and Xiaomi redmi 2 prime (Android 4.4)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 30 (16 by maintainers)
Commits related to this issue
- set the path of the directory of named pipes to fix #3140 — committed to realm/realm-java by zaki50 8 years ago
- allow to put Realm database file on external storage. (#3591) * set the path of the directory of named pipes to fix #3140 * update CHANGELOG * add a test for issue3140 * update test * fol... — committed to realm/realm-java by zaki50 8 years ago
@drjunior sorry for my late reply.
I heard that core team had finished implementing required features. I’ll take a look.
More info from #3413 which should be the same issue.
Thank you for making Realm bug free but there is still one issue.
The above log is from playstore this is from Crashlytics. http://crashes.to/s/305f76efbc2 It is linked to #2762
I have been using Realm before 0.70.0 and this bug is there since the beginning. Almost 5 out of 400 daily users who download my app are experiencing it.
Version of Realm and tooling
Realm version(s): ? 1.2.1
Android Studio version: ? 2.1.1
Which Android version and device: ?