gpt4 book ai didi

android - 安全加密 : Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

转载 作者:行者123 更新时间:2023-12-05 00:18:01 26 4
gpt4 key购买 nike

针对 S+(版本 31 及更高版本)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一。强烈考虑使用 FLAG_IMMUTABLE,只有在某些功能依赖于 PendingIntent 可变时才使用 FLAG_MUTABLE,例如如果它需要与内联回复或气泡一起使用。

堆栈跟踪:

com.google.crypto.tink.shaded.protobuf.FieldType$Collection。 (FieldType.java:337)androidx.security.crypto.EncryptedSharedPreferences$PrefKeyEncryptionScheme。 (加密共享首选项.java:148)PreferenceHelper$Companion.init (PreferenceHelper.kt:41)

这是我初始化 SharedPreferences 的方式:

private lateinit var preferences: SharedPreferences

fun init(context: Context) {
val mainKey = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
preferences = EncryptedSharedPreferences.create(
SHARED_PREF_KEY,
mainKey,
context,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, <- this is the 41 line number, where its crashing
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)

}

有什么帮助吗?

最佳答案

添加此依赖项为我解决了这个问题。

implementation 'androidx.work:work-runtime-ktx:2.7.1'

关于android - 安全加密 : Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70154849/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com