我使用 Nox player 作为模拟器,工作环境是 Android Studio。当前项目的min-SDK版本为23,compileSDK版本为29。
java.lang.NoClassDefFoundError:解析失败:Landroid/security/keystore/KeyGenParameterSpec$Builder;
此错误发生在这部分代码中。
try {
masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
} catch (GeneralSecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
我还添加了这些依赖项。
implementation 'androidx.security:security-crypto:1.0.0-rc04'
implementation "androidx.security:security-identity-credential:1.0.0-alpha02"
我尝试更改android:allowbackup="false"
,也尝试将 min-SDK 版本更改为 24 或更高版本,但同样的问题总是发生。
如果有人有想法,请帮助我。谢谢。(PS 如果您有任何建议在 android 应用程序中保留简单值)