Biometric Prompt crashing on Android 9 and 10 on some devices

android biometric authentication
android fingerprint authentication medium
face unlock android programmatically
google biometric authentication
android face unlock api
fingerprint dialog android
fingerprint android kotlin
fingerprintmanager authenticationcallback deprecated

I am using BiometricPrompt to let the user use fingerprint authentication to log into the app I have done the following in my PasswordActivity class:

     Executor executor = Executors.newSingleThreadExecutor();

    FragmentActivity activity = this;

    final BiometricPrompt biometricPrompt = new BiometricPrompt(activity, executor, new BiometricPrompt.AuthenticationCallback() {
        public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
            super.onAuthenticationError(errorCode, errString);
            if (errorCode == BiometricPrompt.ERROR_NEGATIVE_BUTTON) {
                // user clicked negative button
            } else {
                //TODO: Called when an unrecoverable error has been encountered and the operation is complete.

        public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
            //TODO: Called when a biometric is recognized.
            final String decryptedText = decryptText();
            runOnUiThread(new Runnable() {
                public void run() {
                    if (decryptedText != null && !decryptedText.isEmpty()) {


        public void onAuthenticationFailed() {
            //TODO: Called when a biometric is valid but not recognized.

    final BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder()
            .setTitle("My App"))
            .setSubtitle("Log on into the app"))

    if (sharedPreferenceManager.isFingerprintEnabled(this))

This is the exception that I am getting. Do I have to set?

setNegativeButton (CharSequence text, 
            Executor executor, 
            DialogInterface.OnClickListener listener) as well?

I am using implementation 'androidx.biometric:biometric:1.0.0-alpha03' this version.

Caused by java.lang.IllegalArgumentException: Executor must not be null
   at android.hardware.biometrics.BiometricPrompt$Builder.setNegativeButton + 182(
   at androidx.biometric.BiometricFragment.onCreate + 201(
   at + 2414(
   at + 1418(
   at + 1784(
   at + 1861(
   at + 3269(
   at + 3223(
   at + 190(
   at + 369(
   at + 85(

Try to update the dependency, the currently latest version is already a release candidate:

implementation "androidx.biometric:biometric:1.0.0-rc01"

Biometric, Authenticate with biometrics or device credentials, and perform cryptographic it to API 28 (b/143361271); Fixed an issue on certain devices where the biometric the BiometricPrompt and BiometricManager APIs, as implemented in Android 10, Fixed a potential crash with FingerprintDialogFragment when dismissing it​  <uses-permission android:name="android.permission.USE_BIOMETRIC" android:requiredFeature="false"/> When you declare android:requiredFeature="true" you’re specifying that the application will not work on devices which don’t have a fingerprint sensor. If you didn’t mention android:requiredFeature="false" it will take as true.

Can you try replacing Executor executor = Executors.newSingleThreadExecutor(); with:

private Handler handler = new Handler();

private Executor executor = new Executor() {
    public void execute(Runnable command) {;

This is according to the code given in this tutorial.

Show a biometric authentication dialog, Check that biometric authentication is available; Display the login prompt if a device supports biometric authentication prior to invoking BiometricPrompt by  The Android Framework and Security team has added a number of significant features to the AndroidX Biometric Library, which makes all of the biometric behavior from Android 10 available to all devices that run Android 6.0 (API level 23) or higher. In addition to supporting multiple biometric authentication form factors, the API has made it much

Caused by java.lang.IllegalArgumentException: Executor must not be null
   at android.hardware.biometrics.BiometricPrompt$Builder.setNegativeButton + 182(

This indicates that the framework on the device you're testing is either not receiving the executor from the support library (bug in support library), or the framework itself has a bug.

Could you try on a later version of the androidx.biometric library? Beta02 was recently released, a lot of things have been fixed since alpha03.

Also, what device are you testing, if it's reproducible on Beta02 could you grab a bugreport via adb bugreport and attach your sample app with the bug to the public issue tracker?

Android 10 features and APIs, Android 10 introduces the following improvements to biometric authentication support: Android 10 includes several improvements related to networking and app to prompt the user to change the access point that the device is connected to by into a single logical camera, a feature introduced in Android 9 (API level 28). On Android 10, the library will invoke the corresponding methods from the platform API. On older API levels, the library will emulate the behavior. API changes. Added fragment-specific constructor for biometric prompt (b/131980596) See the “New features” section above. Bug fixes. Add BiometricPrompt device credential support for L+

Detect and diagnose crashes, An app that is written using Java or Kotlin crashes if it throws an unhandled exception, represented by the Throwable class. An app crash on an Android device Some reasons are obvious, like checking for a null value or empty string​, but Build fingerprint: 'google/foo/bar:10/123.456/78910:user/release-keys' ABI​:  Android has supported fingerprint sensors since API 23 and we previously covered the APIs for handling user authentication on Styling Android. However the FingerprintManager class which those tutorials rely upon were deprecated in API 28 (Pie). In this series we’ll look at the new APIs which were introduced in Pie to replace this. Let’s begin…

BiometricPrompt, The operation was canceled because the biometric sensor is unavailable. int, BIOMETRIC_ERROR_HW_NOT_PRESENT. The device does not have a biometric  On devices running P and above, this will show a system-provided authentication prompt, using a device's supported biometric (fingerprint, iris, face, etc). On devices before P, this will show a dialog prompting for fingerprint authentication. The prompt will persist across configuration changes unless explicitly canceled by the client.

Features and APIs Overview, Android 11 provides several APIs to support waterfall displays, displays which wrap Android 11 makes it possible for apps running on devices with hinge-​based Bubbles was an experimental feature in Android 10 that was enabled through a To associate a BiometricPrompt object with an auth-per-use key, add code  Biometric authentication Prerequisites. First, you need to make sure your device supports biometric authentication. Note that though some Android devices support face recognition, this was disabled for Dashlane on Android 9 and below because the feature didn’t meet our security requirements.