Reputation: 1833
Application : FingerPrint Scanner Support
Source : GIT HUB : Android FingerPrint Dialog
Issue : Nullpointer exception
File Name : MainAcitivty.java
Method :
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);
}
}
Getting Nullpointer Exception
in this method.
Is it due to keystore
or Cipher
initialization ?
Upvotes: 2
Views: 730
Reputation: 5081
Maybe the @Inject annotation has failed you so your mKeyStore is still null? You could try pulling the initialization out of the FingerprintModule and into the onCreate of MainActivity.
Upvotes: 1