Android crashed after updating androidx biometric to 1.0.0-alpha04
EDIT: The issue seems to be resolved, see @olearyj234's comment/answer for the correct way to reolve the issue with beta01 and newer.
--
There seems to be an issue with alpha04, reverting to alpha03 fixes it. Guess we'll have to wait for alpha05 before upgrading.
Just wish Google had waited until the biometrics library was out of alpha before deprecating the fingerprint library...
The problem is fixed in androidx.biometric:biometric:1.0.0-beta01
by providing a second constructor. Until this release, i solved the issue by reverting to alpha03
but there's an actual solution available now.
You can find the beta01
release notes here
We’ve introduced a second constructor for BiometricPrompt that allows it to be hosted in a Fragment (as opposed to the existing constructor, which requires a FragmentActivity).
You can find the new BiometricPrompt
constructor documentation here
BiometricPrompt(Fragment fragment, Executor executor, BiometricPrompt.AuthenticationCallback callback)
To fix, please follow the simple steps:
- Change your build.gradle to use biometric version
1.0.0-beta01
Use the new constructor. In short, change the first argument to your fragment instead of the activity. See my code change below:
val biometricPrompt = BiometricPrompt(activity!!, executor, callback) // Change the above line to the below line val biometricPrompt = BiometricPrompt(this, executor, callback)