Android Question biometric library error

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Using the lib and example of : https://www.b4x.com/android/forum/threads/biometricmanager-biometric-authentication.111256/
b4a 10.7 install from scratch, last SKD and so on...
Running on a S7
Pressing the Authenticate button...
Im getting the following error

How to solve this?
Thanks
 

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
FWIW this is the log unfiltered in Debug mode
 
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Trying with
B4X:
#Extends: android.support.v7.app.AppCompatActivity
#AdditionalJar: com.android.support:appcompat-v7
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Download the example. Don't make any change and run it. What happens?

It works perfectly fine on Pixel 4XL with face unlock., I didn't test on the 5XL because I already know that it works on that device.

But on a Nexus 6P it fails with the following error
Nexus 6P error code - Finger print sensor:
Logger connected to:  Huawei Nexus 6P
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 30 (BiometricManager)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
    at b4a.example.biometricmanager._canauthenticate(biometricmanager.java:83)
    at b4a.example.main._activity_create(main.java:399)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at b4a.example.main.afterFirstLayout(main.java:105)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.SecurityException: Must have android.permission.USE_FINGERPRINT permission.: Neither user 10099 nor current process has android.permission.USE_FINGERPRINT.
    at android.os.Parcel.readException(Parcel.java:2013)
    at android.os.Parcel.readException(Parcel.java:1959)
    at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.isHardwareDetected(IFingerprintService.java:439)
    at android.hardware.fingerprint.FingerprintManager.isHardwareDetected(FingerprintManager.java:777)
    at androidx.core.hardware.fingerprint.FingerprintManagerCompat.isHardwareDetected(FingerprintManagerCompat.java:83)
    at androidx.biometric.BiometricManager.canAuthenticateWithFingerprint(BiometricManager.java:498)
    at androidx.biometric.BiometricManager.canAuthenticateCompat(BiometricManager.java:399)
    at androidx.biometric.BiometricManager.canAuthenticate(BiometricManager.java:343)
    at androidx.biometric.BiometricManager.canAuthenticate(BiometricManager.java:314)
    ... 20 more
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
@Peter try to add:
B4X:
AddPermission(android.permission.USE_FINGERPRINT)

Good morning @Erel,
I've added the line and even though the app actually starts now (one can now see the 'Authenticate' button), when the button is clicked the following error occurs.

B4X:
Logger connected to:  Huawei Nexus 6P
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.NoSuchFieldError: No static field colorError of type I in class Landroidx/biometric/R$attr; or its superclasses (declaration of 'androidx.biometric.R$attr' appears in /data/app/b4a.example-lczD6LPPSrf0CMqkiUibOQ==/base.apk)
    at androidx.biometric.FingerprintDialogFragment$Api26Impl.getColorErrorAttr(FingerprintDialogFragment.java:440)
    at androidx.biometric.FingerprintDialogFragment.onCreate(FingerprintDialogFragment.java:161)
    at androidx.fragment.app.Fragment.performCreate(Fragment.java:2685)
    at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:280)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1187)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1368)
    at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1446)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1509)
    at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447)
    at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2181)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2004)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1959)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1861)
    at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

I also tried deleting my current Android SDK and download a new one. Once that didn't work either, I restored my Android SDK backup with updates, I'm still getting the exact same error...
 
Last edited:
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Hi, download the updated example, I get this error:
FWIW my SDK sais:
B4A Sdk Manager: 3.71
TempFolder = C:\Users\Usuario\AppData\Roaming\ANYWHE~1\BASIC4~1\temp
DataFolder: C:\Users\Usuario\AppData\Roaming\B4ASdkManager
SDK version: 6609375
 
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
@lucasms dont know what you mean, Ive downloaded the last example update fro Erel and in the manifest it sais:
AddPermission(android.permission.USE_BIOMETRIC)
AddPermission(android.permission.USE_FINGERPRINT)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…