When using
androidx.security:security-crypto:1.0.0-rc01
The app runs fine, when using the new
androidx.security:security-crypto:1.0.0-rc02
I get the following
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'
The command that fails is
return EncryptedSharedPreferences.create(
"app",
masterKeyAlias,
context,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM);
Is that mean I should use a different schema? What about current sharedPreferences file that is in use? It will fail because of that, no? Any idea what can be done? Thanks
This version of the library fixes the problem that was caused by the previous RC version. I can't remember exactly what it was, but it was something to do with the
tinclibrary and dependancy clash with other libraries like Firebase.To fix the previous issue I had to add the following to my
build.gradle:Removing it again fixed the same crash as you had here.