Skip to content
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

Caused by: java.lang.RuntimeException: Unspecified exception. Invalid database in io_realm_internal_SharedGroup.cpp line 101 #808

Closed
eugeneek opened this issue Feb 1, 2015 · 4 comments

Comments

@eugeneek
Copy link

eugeneek commented Feb 1, 2015

I use latest 0.78 jar library. I need encryption on my realm db, but i get error after app closed and released from memory.

java.lang.RuntimeException: Unspecified exception. Invalid database in io_realm_internal_SharedGroup.cpp line 101
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2464)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5653)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Unspecified exception. Invalid database in io_realm_internal_SharedGroup.cpp line 101
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(Native Method)
at io.realm.internal.SharedGroup.(SharedGroup.java:55)
at io.realm.Realm.(Realm.java:159)
at io.realm.Realm.createAndValidate(Realm.java:441)
at io.realm.Realm.create(Realm.java:418)
at io.realm.Realm.getInstance(Realm.java:336)

@kneth
Copy link
Member

kneth commented Feb 2, 2015

This error can only occur when you open an instance of a Realm file (the getInstance() call). Can you provide a little background information?

  • do you use encryption? and do you use the same encryption key?
  • did you delete your Realm file (the deleteRealmFile() method) after calling getInstance()?
  • do you try to open a non-default Realm file in a non-existing folder?

@eugeneek
Copy link
Author

eugeneek commented Feb 2, 2015

I use encryption. I use code below while get realm instance:
byte[] key = new byte[64];
new SecureRandom().nextBytes(key);
realm = Realm.getInstance(this, "name", key);

No, i don't delete realm file after calling getInstance(). This exception occurs exactly on getInstance() line.

I try to open non-default file but don't try non-default folder.

@emanuelez
Copy link
Contributor

It looks like you're trying to access the Realm file with a different key every time since you don't provide a seed to SecureRandom. That will of course provoke the error you reported.

@eugeneek
Copy link
Author

eugeneek commented Feb 3, 2015

Thank you, it was my bad. But i do exactly what i saw in docs. Please update docs, because there still
Using Encryption requires building Realm from source. and used 32 length byte array for key.

@eugeneek eugeneek closed this as completed Feb 3, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants