'Could not encrypt/decrypt the value for SecureStore' error on android app
Problem
Minimal reproducible example https://snack.expo.dev/@simranjits11/error-with-securestorage Summary Context When trying to get item using `await SecureStore.getItemAsync('mobile')`. It throws an error saying `Could not encrypt/decrypt the value for SecureStore`. The error is very device specific and happens occasionally. - Message: Error: Could not encrypt/decrypt the value for SecureStore . - SDK: 47.0.12 - Device: OnePlus 8T (Android 13) Stack Trace [code block] Environment expo-env-info 1.0.5 environment info: System: OS: macOS 13.3.1 Shell: 5.9 - /bin/zsh Binaries: Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.6.7 - ~/Documents/Projects/realmagic/node_modules/.bin/npm Watchman: 2023.02.20.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/simranjitsingh/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7678000 Xcode: 14.3/14E222b - /usr/bin/xcodebuild npmPackages: react: 18.1.0 => 18.1.0 react-dom: 18.1.0 => 18.1.0 npmGlobalPackages: eas-cli: 3.15.0 expo-cli: 6.3.2 Expo Workflow: managed
Error Output
error saying `Could not encrypt/decrypt the value for SecureStore`. The error is very device specific and happens occasionally.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: 'Could not encrypt/decrypt the value for SecureStore' error on android app
@behenate I have noticed that this issue mostly comes up if i install a new build (apk) without clearing the app data (by going to app info in device settings) of the previously installed build. If i clear the app data and then uninstall the previous build before installing the new build, then i don't see the issue. I haven't tested a lot of devices for this behaviour so not sure if this is cons
Trust Score
6 verifications
- 1
Step 1
I have noticed that this issue mostly comes up if i install a new build (apk) without clearing the app data (by going to app info in device settings) of the previously installed build.
- 2
If i clear the app data and then uninstall the previous build before installing
If i clear the app data and then uninstall the previous build before installing the new build, then i don't see the issue. I haven't tested a lot of devices for this behaviour so not sure if this is consistent across all devices, but found this interesting. It might help you pin point the issue.
- 3
Seems like the previously present app data/cache is causing the issue in the new
Seems like the previously present app data/cache is causing the issue in the new build in some device models
Validation
Resolved in expo/expo GitHub issue #23426. Community reactions: 21 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep