val masterKey =\n MasterKey\n .Builder(applicationContext)\n .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)\n .build()\nRun Code Online (Sandbox Code Playgroud)\n在即时应用程序中运行此代码会使我的应用程序崩溃,并显示以下堆栈跟踪:
\n2020-12-21 13:07:29.654 28949-28949/com.example.instantappandroidkeystore E/AndroidRuntime: FATAL EXCEPTION: main\n Process: com.example.instantappandroidkeystore, PID: 28949\n java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.instantappandroidkeystore/com.example.instantappandroidkeystore.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method \'int android.security.keystore.IKeystoreService.exist(java.lang.String, int)\' on a null object reference\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3448)\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)\n at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)\n at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)\n at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)\n at android.os.Handler.dispatchMessage(Handler.java:107)\n at android.os.Looper.loop(Looper.java:237)\n at android.app.ActivityThread.main(ActivityThread.java:7814)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)\n Caused by: java.lang.NullPointerException: Attempt to invoke interface method \'int android.security.keystore.IKeystoreService.exist(java.lang.String, int)\' on a null …Run Code Online (Sandbox Code Playgroud) encryption keystore kotlin android-keystore android-instant-apps