flutter_secure_storage: Weird exception on first start Android 11 Samsung A51

Hello, as title says weird error appearing. Device: Samsung A51 Android: 11

The following error appears TWICE for the first start; then never again. After uninstall it appears again.

W/AndroidKeysetManager(30639): keyset not found, will generate a new one
W/AndroidKeysetManager(30639): java.io.FileNotFoundException: can’t read keyset; the pref value __androidx_security_crypto_encrypted_prefs_key_keyset__ does not exist
W/AndroidKeysetManager(30639): 	at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readPref(SharedPrefKeysetReader.java:71)
W/AndroidKeysetManager(30639): 	at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readEncrypted(SharedPrefKeysetReader.java:89)
W/AndroidKeysetManager(30639): 	at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:105)
W/AndroidKeysetManager(30639): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
W/AndroidKeysetManager(30639): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
W/AndroidKeysetManager(30639): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
W/AndroidKeysetManager(30639): 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:155)
W/AndroidKeysetManager(30639): 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
W/AndroidKeysetManager(30639): 	at [com.it](http://com.it/)_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.initializeEncryptedSharedPreferencesManager(FlutterSecureStoragePlugin.java:136)
W/AndroidKeysetManager(30639): 	at [com.it](http://com.it/)_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.ensureInitialized(FlutterSecureStoragePlugin.java:105)
W/AndroidKeysetManager(30639): 	at [com.it](http://com.it/)_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.access$100(FlutterSecureStoragePlugin.java:37)
W/AndroidKeysetManager(30639): 	at [com.it](http://com.it/)_nomads.fluttersecurestorage.FlutterSecureStoragePlugin$MethodRunner.run(FlutterSecureStoragePlugin.java:299)
W/AndroidKeysetManager(30639): 	at android.os.Handler.handleCallback(Handler.java:938)
W/AndroidKeysetManager(30639): 	at android.os.Handler.dispatchMessage(Handler.java:99)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 18 (1 by maintainers)

Most upvoted comments

Still happens on flutter_secure_storage: 6.0.0, initial launch.

[log] initialLaunch null
W/AndroidKeysetManager(24394): keyset not found, will generate a new one
W/AndroidKeysetManager(24394): java.io.FileNotFoundException: can't read keyset; the pref value __androidx_security_crypto_encrypted_prefs_key_keyset__ does not exist
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readPref(SharedPrefKeysetReader.java:71)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readEncrypted(SharedPrefKeysetReader.java:89)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:105)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
W/AndroidKeysetManager(24394): 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:155)
W/AndroidKeysetManager(24394): 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.initializeEncryptedSharedPreferencesManager(FlutterSecureStorage.java:226)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.ensureInitialized(FlutterSecureStorage.java:149)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.deleteAll(FlutterSecureStorage.java:115)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin$MethodRunner.run(FlutterSecureStoragePlugin.java:182)
W/AndroidKeysetManager(24394): 	at android.os.Handler.handleCallback(Handler.java:938)
W/AndroidKeysetManager(24394): 	at android.os.Handler.dispatchMessage(Handler.java:99)
W/AndroidKeysetManager(24394): 	at android.os.Looper.loop(Looper.java:236)
W/AndroidKeysetManager(24394): 	at android.os.HandlerThread.run(HandlerThread.java:67)
W/AndroidKeysetManager(24394): keyset not found, will generate a new one
W/AndroidKeysetManager(24394): java.io.FileNotFoundException: can't read keyset; the pref value __androidx_security_crypto_encrypted_prefs_value_keyset__ does not exist
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readPref(SharedPrefKeysetReader.java:71)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readEncrypted(SharedPrefKeysetReader.java:89)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:105)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
W/AndroidKeysetManager(24394): 	at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
W/AndroidKeysetManager(24394): 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:160)
W/AndroidKeysetManager(24394): 	at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.initializeEncryptedSharedPreferencesManager(FlutterSecureStorage.java:226)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.ensureInitialized(FlutterSecureStorage.java:149)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.deleteAll(FlutterSecureStorage.java:115)
W/AndroidKeysetManager(24394): 	at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin$MethodRunner.run(FlutterSecureStoragePlugin.java:182)
W/AndroidKeysetManager(24394): 	at android.os.Handler.handleCallback(Handler.java:938)
W/AndroidKeysetManager(24394): 	at android.os.Handler.dispatchMessage(Handler.java:99)
W/AndroidKeysetManager(24394): 	at android.os.Looper.loop(Looper.java:236)
W/AndroidKeysetManager(24394): 	at android.os.HandlerThread.run(HandlerThread.java:67)

I second @zigapovhe and don’t think that this issue should be closed.

Same issue on Google Pixel 3XL, Android 12.

I have encountered this error when someone tried to migrate to the new encrypted method for android. See https://github.com/mogol/flutter_secure_storage/issues/313

I have a few other plugins that require some attention so i don’t have the time to look in to this right now. It would be great if some could debug this and check what the problem can be. I will check all PR’s asap.

this an android jetpack crypto lib “problem” (it’s just a debug message…) so not related to this plugin and nothing they can do about it

Well, this is not the case in 4.2.1 version of flutter_secure_storage plugin. At least what @mogol can do is downgrade the crypto library to the same version as it was in v4.2.1. If this is really just a “debug message”, something else is going on in flutter_secure_storage, because the plugin never initialize after this error occur (can be replicated by clearing app storage). I wouldn’t close the issue if people still experience the same issue on latest version (6.0.0). @juliansteenbakker

same issue in android 12 Samsung A52S