{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/3140","repository_url":"https://api.github.com/repos/realm/realm-java","labels_url":"https://api.github.com/repos/realm/realm-java/issues/3140/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/3140/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/3140/events","html_url":"https://github.com/realm/realm-java/issues/3140","id":163923106,"number":3140,"title":"Error: Operation not permitted in io_realm_internal_SharedGroup.cpp","user":{"login":"Snakeice","id":10998336,"avatar_url":"https://avatars.githubusercontent.com/u/10998336?v=3","gravatar_id":"","url":"https://api.github.com/users/Snakeice","html_url":"https://github.com/Snakeice","followers_url":"https://api.github.com/users/Snakeice/followers","following_url":"https://api.github.com/users/Snakeice/following{/other_user}","gists_url":"https://api.github.com/users/Snakeice/gists{/gist_id}","starred_url":"https://api.github.com/users/Snakeice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Snakeice/subscriptions","organizations_url":"https://api.github.com/users/Snakeice/orgs","repos_url":"https://api.github.com/users/Snakeice/repos","events_url":"https://api.github.com/users/Snakeice/events{/privacy}","received_events_url":"https://api.github.com/users/Snakeice/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-05T19:06:10Z","updated_at":"2016-07-05T22:15:18Z","closed_at":null,"body":"#### Goal\r\n\r\n> What do you want to achieve?\r\n\r\n#### Actual Results\r\n\r\nio.realm.exceptions.RealmError: Unrecoverable error. Operation not permitted in io_realm_internal_SharedGroup.cpp line 113\r\n\tat io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(Native Method)\r\n\tat io.realm.internal.SharedGroup.openSharedGroupOrFail(SharedGroup.java:95)\r\n\tat io.realm.internal.SharedGroup.&lt;init&gt;(SharedGroup.java:74)\r\n\tat io.realm.internal.SharedGroupManager.&lt;init&gt;(SharedGroupManager.java:49)\r\n\tat io.realm.BaseRealm.&lt;init&gt;(BaseRealm.java:81)\r\n\tat io.realm.Realm.&lt;init&gt;(Realm.java:140)\r\n\tat io.realm.Realm.createAndValidate(Realm.java:240)\r\n\tat io.realm.Realm.createInstance(Realm.java:220)\r\n\tat io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)\r\n\tat io.realm.Realm.getDefaultInstance(Realm.java:166)\r\n\tat br.com.jbsoft.mobile.di.modules.ProviderModule.provideRealm(ProviderModule.java:28)\r\n\tat br.com.jbsoft.mobile.di.modules.ProviderModule_ProvideRealmFactory.get(ProviderModule_ProvideRealmFactory.java:19)\r\n\tat br.com.jbsoft.mobile.di.modules.ProviderModule_ProvideRealmFactory.get(ProviderModule_ProvideRealmFactory.java:8)\r\n\tat br.com.jbsoft.mobile.models.ControleUsuario_MembersInjector.injectMembers(ControleUsuario_MembersInjector.java:33)\r\n\tat br.com.jbsoft.mobile.models.ControleUsuario_MembersInjector.injectMembers(ControleUsuario_MembersInjector.java:9)\r\n\tat br.com.jbsoft.mobile.di.components.DaggerProviderComponent.inject(DaggerProviderComponent.java:243)\r\n\tat br.com.jbsoft.mobile.models.ControleUsuario.inject(ControleUsuario.java:31)\r\n\tat br.com.jbsoft.mobile.models.ControleUsuario.getUsuario(ControleUsuario.java:35)\r\n\tat br.com.jbsoft.mobile.views.Main.onCreate(Main.java:59)\r\n\tat br.com.jbsoft.mobile.componentes.BaseActivity.onCreate(BaseActivity.java:86)\r\n\tat android.app.Activity.performCreate(Activity.java:6500)\r\n\tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)\r\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)\r\n\tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)\r\n\tat android.app.ActivityThread.access$1000(ActivityThread.java:198)\r\n\tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)\r\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\r\n\tat android.os.Looper.loop(Looper.java:145)\r\n\tat android.app.ActivityThread.main(ActivityThread.java:6837)\r\n\tat java.lang.reflect.Method.invoke(Native Method)\r\n\tat java.lang.reflect.Method.invoke(Method.java:372)\r\n\tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)\r\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)\r\n\r\n#### Steps & Code to Reproduce\r\n\r\n>Just start the application and get the exception :[\r\n\r\n#### Code Sample\r\n\r\nMy config\r\n```java\r\n        RealmConfiguration configuration = new RealmConfiguration\r\n                .Builder(this, new File(getCaminhoDB(Boolean.FALSE)))\r\n                .name(Constantes.arquivos.DB_REALM_FINAL)\r\n               .encryptionKey(Preferencias.getInstance().getDbk())\r\n                .schemaVersion(BuildConfig.DB_VERSION)\r\n                .modules(new InitialVersion())\r\n                .migration(new MigrationDB())\r\n                .build();\r\n\r\n        Realm.setDefaultConfiguration(configuration);\r\n        RealmLog.add(new DebugAndroidLogger());\r\n\r\n\r\n```\r\nand getCaminhoDB:\r\n\r\n```java\r\n  private static String getCaminhoDB(@NonNull Context context) {\r\n        if (isExternalStorageWritable()) {\r\n            return context.getExternalFilesDir(\"database\").toString();\r\n        } else {\r\n            return context.getFilesDir().getAbsolutePath();\r\n        }\r\n    }\r\n\r\n```\r\ngetKeyDef():\r\n\r\n```java\r\n\r\n    public static byte[] getKeyDef() {\r\n        byte[] key = new byte[64];\r\n        String s = \"***********************************************************************\";\r\n        try {\r\n            new SecureRandom(s.getBytes(\"us-ascii\")).nextBytes(key);\r\n        } catch (UnsupportedEncodingException e) {\r\n            e.printStackTrace();\r\n        }\r\n        return key;\r\n    }\r\n```\r\n\r\n#### Version of Realm and tooling\r\nRealm version(s): 1.1.0\r\n\r\nAndroid Studio version: 2.1.2\r\n\r\nWhich Android version and device: I test with Emulator (Android 6.0) and Xiaomi redmi 2 prime (Android 4.4) \r\n"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/230618923","html_url":"https://github.com/realm/realm-java/issues/3140#issuecomment-230618923","issue_url":"https://api.github.com/repos/realm/realm-java/issues/3140","id":230618923,"user":{"login":"zaki50","id":406660,"avatar_url":"https://avatars.githubusercontent.com/u/406660?v=3","gravatar_id":"","url":"https://api.github.com/users/zaki50","html_url":"https://github.com/zaki50","followers_url":"https://api.github.com/users/zaki50/followers","following_url":"https://api.github.com/users/zaki50/following{/other_user}","gists_url":"https://api.github.com/users/zaki50/gists{/gist_id}","starred_url":"https://api.github.com/users/zaki50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaki50/subscriptions","organizations_url":"https://api.github.com/users/zaki50/orgs","repos_url":"https://api.github.com/users/zaki50/repos","events_url":"https://api.github.com/users/zaki50/events{/privacy}","received_events_url":"https://api.github.com/users/zaki50/received_events","type":"User","site_admin":false},"created_at":"2016-07-05T22:15:17Z","updated_at":"2016-07-05T22:15:17Z","body":"Hi @Snakeice \r\n\r\nThe argument in `getCaminhoDB(Boolean.FALSE)` is `Boolean`, but defined method accepts `Context`.\r\n\r\nCan you provide the path that `getCaminhoDB()` returned?\r\n"}}
{"actor":{"display_login":"zaki50"}}