Android M指纹扫描仪支持获取空指针异常的示例

Android M指纹扫描仪支持获取空指针异常的示例,android,nullpointerexception,keystore,secret-key,Android,Nullpointerexception,Keystore,Secret Key,应用:指纹扫描仪支持 资料来源:GIT HUB: 问题:空指针异常 文件名:mainacitivity.java 路径: 方法: private boolean initCipher() { try { mKeyStore.load(null); SecretKey key = (SecretKey) mKeyStore.getKey(KEY_NAME, null); mCipher.init(Ci

应用:指纹扫描仪支持

资料来源:GIT HUB:

问题:空指针异常

文件名:mainacitivity.java

路径:

方法:

   private boolean initCipher() {
        try {
            mKeyStore.load(null);
            SecretKey key = (SecretKey) mKeyStore.getKey(KEY_NAME, null);  
            mCipher.init(Cipher.ENCRYPT_MODE, key);
            return true;
        } catch (KeyPermanentlyInvalidatedException e) {
            return false;
        } catch (KeyStoreException | CertificateException | UnrecoverableKeyException | IOException
                | NoSuchAlgorithmException | InvalidKeyException e) {
            throw new RuntimeException("Failed to init Cipher", e);
        }
    }
在此方法中获取
空指针异常


是由于
密钥库
还是
密码
初始化

也许@Inject注释使您失败,所以您的mKeyStore仍然为空?您可以尝试将初始化从FingerPrint模块中拉出来,进入onCreate of MainActivity。

如何运行应用程序:指纹扫描仪支持来源:GIT HUB:Android指纹对话框在marshmallow和更低版本中如果运行4.4.2版本,它将崩溃