question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get Realm file decryption failed

See original GitHub issue

when i’m trying to use encrypt feature on my project, i get this error:

this is my Application class content:

/* SetUp Application database as encrypted contents */
byte[] key = new byte[64];
new SecureRandom().nextBytes(key);
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
        .encryptionKey(key)
        .name("Application.db")
        .deleteRealmIfMigrationNeeded()
        .build();

full stack error:

Caused by: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.pishguy.androidapplication.cafemaku/files/Application.db': Realm file decryption failed. in /Users/emanuelez/repos/realm/realm-java-private/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 81 Kind: ACCESS_ERROR.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
Zhuindencommented, Oct 2, 2016

… I’ve heard something about a “KeyStore” that you’re supposed to store things in on Android, but I don’t know much about it nor its reliability

1reaction
cmelchiorcommented, Nov 6, 2018

You cannot delete a Realm while it is open and Realm.getDefaultInstance will open a Realm.

Do this instead:

Realm.deleteRealm(Realm.getDefaultConfiguration());
Read more comments on GitHub >

github_iconTop Results From Across the Web

Seeing "Realm file decryption failed" errors #5615 - GitHub
For 99% of users, this works fine. For less than 1%, we're seeing the "Realm file decryption failed" error. From investigating, it seems...
Read more >
Realm file decryption failed` exception - Stack Overflow
It turns out the problem was caused by a bug in Realm, where deleteRealmIfMigrationNeeded = true when using encryption ...
Read more >
Realm decryption failed on ios device but not on emulator (ios ...
Hi, We have been trying to get a realm encryption solution created across our whole application. This has worked successfully across the ...
Read more >
Realm Custom Configuration and Encryption (RealmSwift Part ...
The first time you open your encrypted file, Realm creates it on disk and encrypts it with the given key. Any time in...
Read more >
realm encription, Realm file decryption failed,what's wrong?
Related Query · Find path for Realm file with Realm React Native to use with Realm Browser · Opening Realm file in browser...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found