So I'm trying to create the Encrypted Shared prefs as shown in the dev android side : https://developer.android.com/reference/androidx/security/crypto/EncryptedSharedPreferences#inherited-methods And android studio doesn't seem to recognize it all all. My min skd is 23 is that reason form what I understand so far androidx doesnt require the newest android version?
Tried clean rebuild build etc. Tried migrating to androidx from Android studio menu ( getting the message of no usages found in project but I do have a few imports for androidx as I understood after checking it out)
import androidx.security.crypto.EncryptedSharedPreferences;
String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
SharedPreferences sharedPreferences = EncryptedSharedPreferences.create(
"secret_shared_prefs",
masterKeyAlias,
context,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
);
//doesnt recognise MasterKeys nor EncryptedSharedPreferences classes
As per the androidx.security
Declaring dependencies documentation, you need to add the dependency on the library:
dependencies {
def security_version = "1.0.0-alpha02"
implementation "androidx.security:security-crypto:$security_version"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With