Tink GeneralSecurityException:找不到密钥模板:AES128_GCM Tink

Tink GeneralSecurityException: cannot find key template: AES128_GCM Tink

我尝试过的 运行 :

KeysetHandle keyHandler = KeysetHandle.generateNew(KeyTemplates.get("AES128_GCM"));

我得到的错误:

java.security.GeneralSecurityException: cannot find key template: AES128_GCM
     at com.google.crypto.tink.KeyTemplates.get(KeyTemplates.java:37)
     at com.example.AppName.password_pin.onCreate(password_pin.java:59)
     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)

我错过了什么吗?我是不是不小心跳过了一些步骤?

注册缺失,例如:

AeadConfig.register();

另请参阅 Tink documentation (current Version v1.6.1)