java - API<20 的 java.lang.VerifyError
问题描述
我制作了一个支持指纹安全的应用程序。只要我在大于 API 19 的 API 上运行它,一切正常。当然,自 Marshmallow 以来,指纹仅在设备中受支持,所以我用
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES. M) {}
我收到以下错误:
java.lang.VerifyError: com/myapp/newapp/Introduction
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
我附上它,是由这部分代码引起的:
try {
keyStore.load(null);
SecretKey key = (SecretKey) keyStore.getKey(KEY_NAME,
null);
cipher.init(Cipher.ENCRYPT_MODE, key);
//Return true if the cipher has been initialized successfully//
return true;
} catch (KeyPermanentlyInvalidatedException e) {
//Return false if cipher initialization failed//
return false;
} catch (KeyStoreException | CertificateException
| UnrecoverableKeyException | IOException
| NoSuchAlgorithmException | InvalidKeyException e) {
throw new RuntimeException("Failed to init Cipher", e);
}
我不知道如何解决它。
解决方案
推荐阅读
- excel - 因此,当使用动态命名范围时,显然 INDIRECT 函数不适用于 Excel 中的数据验证
- angular - 基于垫选项卡单击垫展开折叠应显示
- amazon-ec2 - 无法从 RhinoSecurityLabs 克隆 CloudGoat
- c - 带有一个参数的 zsh export 似乎并没有真正创建环境变量
- codeigniter - 如何将 Mailgun 变量添加到模板中?
- python-3.x - 在 pygame 中发现了一个奇怪的 hitbox 错误。如果玩家在我的游戏中死亡,hitbox 仍然存在,这会产生一些问题
- swiftui - 如何在 SwiftUI 中的视图中调用方法
- excel - excel公式本地化
- javascript - 如何在将 .ticks() 应用于我的 x 刻度时解决 d3 js 中的此错误
- linux - 如何帮助可执行文件找到共享库?