Android Question BiometricManager - Maven artifact not found

LucaMs

Expert
Licensed User
Longtime User
I tried the example attached to BiometricManager - Biometric Authentication
and got:
1618738947266.png


Installed all items suggested by SDK Manager.
Tried with Android API 30 and 29.
 

LucaMs

Expert
Licensed User
Longtime User
2. Open B4A sdk manager and install the missing resource. Don't assume that it will be in the recommended items list.
Done. Now I get:

Generating R file. Error
c:\android\tools\..\extras\b4a_remote\androidx\savedstate\savedstate\1.1.0\unpacked-savedstate-1.1.0\res\values\values.xml:3: error: Found tag id where item is expected
c:\android\tools\..\extras\b4a_remote\androidx\lifecycle\lifecycle-viewmodel\2.3.1\unpacked-lifecycle-viewmodel-2.3.1\res\values\values.xml:3: error: Found tag id where item is expected
c:\android\tools\..\extras\b4a_remote\androidx\lifecycle\lifecycle-runtime\2.3.1\unpacked-lifecycle-runtime-2.3.1\res\values\values.xml:3: error: Found tag id where item is expected
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Unfiltered logs are useful to make you crazy!
... but I tried and maybe the "main" error message is:
FATAL EXCEPTION: main
Process: b4a.example, PID: 6611
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/arch/core/executor/ArchTaskExecutor;
at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:316)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:172)
at androidx.activity.ComponentActivity.<init>(ComponentActivity.java:228)
at androidx.fragment.app.FragmentActivity.<init>(FragmentActivity.java:103)
at b4a.example.main.<init>(main.java:17)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1178)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3191)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.arch.core.executor.ArchTaskExecutor" on path: DexPathList[[zip file "/data/app/b4a.example-ap4Rh99vz15raeovks0Ufw==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-ap4Rh99vz15raeovks0Ufw==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 17 more
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Add this line and clean the project:
B4X:
#AdditionalJar: androidx.arch.core:core-runtime
Does it work?

Now I got an error message with filtered logs:
B4X:
    Dim v As Int = Manager.RunMethod("canAuthenticate", Null)
** 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:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Caused by: java.lang.SecurityException: Must have android.permission.USE_FINGERPRINT permission.: Neither user 10330 nor current process has android.permission.USE_FINGERPRINT.
at android.os.Parcel.readException(Parcel.java:1954)
at android.os.Parcel.readException(Parcel.java:1900)
at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.isHardwareDetected(IFingerprintService.java:455)
at android.hardware.fingerprint.FingerprintManager.isHardwareDetected(FingerprintManager.java:772)
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

LucaMs

Expert
Licensed User
Longtime User
What that means? Not literally, I would like to know the specific meaning related to the context.
Ok, I understand the matter; I thought that my smartphone had memorized my fingerprint and used it to unlock the screen, but no. Now it does and the app no longer gives me that message (NONE_ENROLLED); however as soon as I press the "Please authenticate" the app crashes again:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
--------- beginning of crash
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-cVSzCZ_JU6hTGVHxWrHPGw==/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:2949)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
 
Upvote 0
Top