I have a DialogFragment that handles login and fingerprint authentication for my application. This fragment uses two classes that are exclusive to API 23,
DialogFragment
I had the same error and solved it the following way:
catch (Exception e) { if (e instanceof KeyPermanentlyInvalidatedException) { //your error handling goes here }
It isn't vey nice, but it works