[SDK 35] expo-local-authentication error in Android build

Hi all,

I’am getting the following error (logged in Sentry) while testing my Android (apk) build in the Android simulator.

Encountered an exception while calling native method: Exception occurred while executing exported method hasHardwareAsync on module ExpoLocalAuthentication: null

Using SDK 35 in managed workflow and "expo-local-authentication": "~7.0.0"

When running the app in development on the Android Emulator in the Expo Client there is no error occurring.

Someone able to help?

Just tested it again with a Fingerprint set up on the Android Simulator but the same error occurred.

Hi. Can you post the code?

Ow wow, how can I forget…

Importing it as:

import {
  AuthenticationType,
  hasHardwareAsync,
  isEnrolledAsync,
  supportedAuthenticationTypesAsync,
} from 'expo-local-authentication';

And using it with:

Promise.all([
    hasHardwareAsync(),
    isEnrolledAsync(),
    supportedAuthenticationTypesAsync(),
  ])
    .then(([isAvailable, isEnrolled, supportedTypes]) => ({
      isAvailable,
      isEnrolled,
      supportedTypes,
    }))

Nobody has an idea? I was not yet able to test it on a real Android device. Is it likely that it is only the simulator?

Can confirm now that it’s also crashing on Android builds on some real devices. Is this an Expo bug?

Was missing the “USE_FINGERPRINT” permission for Android. Adding that fixed the issue. Maybe it’s an idea to add it in the local-authentication documentation that this permission is required on Android. Because I completely missed it and the error isn’t clear that it’s a permission issue.

4 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.