使用
androidx.security:security-crypto:1.0.0-rc01
该应用程序运行良好,当使用新的
androidx.security:security-crypto:1.0.0-rc02
我得到以下内容
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.appm, PID: 12145
java.lang.NoSuchMethodError: No static method aes256SivTemplate()Lcom/google/crypto/tink/KeyTemplate; in class Lcom/google/crypto/tink/daead/AesSivKeyManager; or its super classes (declaration of 'com.google.crypto.tink.daead.AesSivKeyManager' appears in /data/app/com.app.appm-mak-CE5Ycx65IADcRe9FQw==/base.apk)
at androidx.security.crypto.EncryptedSharedPreferences$PrefKeyEncryptionScheme.<clinit>(EncryptedSharedPreferences.java:146)
at com.app.appm.Utils.getPrefs(Utils.java:455)
at com.app.appm.MainActivity.onCreate(MainActivity.java:184)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process: Sending signal. PID: 12145 SIG: 9
Disconnected from the target VM, address: 'localhost:8601', transport: 'socket'
失败的命令是
return EncryptedSharedPreferences.create(
"app",
masterKeyAlias,
context,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM);
这是否意味着我应该使用不同的架构?当前正在使用的共享首选项文件呢?它会因此而失败,不是吗?知道可以做什么吗?谢谢
此版本的库修复了由以前的 RC 版本引起的问题。我不记得具体是什么,但它与tinc
库以及与Firebase等其他库的依赖冲突有关。
要解决上一个问题,我必须在build.gradle
中添加以下内容:
allprojects {
configurations.all {
resolutionStrategy {
force("com.google.crypto.tink:tink-android:1.3.0-rc1")
}
}
}
再次删除它修复了与您在此处相同的崩溃。